JointTrajectory Python interface
Hi, I am trying to make my own environment that will be used for reinforcement learning training, with the help of gym-gazebo. I want to train a floating gripper to pick up an object from ground. The problem is, that I want to control the hardware interfaces through python, but the implementation seems unclear to me. In the gym-gazebo turtlebot camera implementation it seems simple(although they are using Twist from geometry msgs).
How do I use JointTrajectory in the same way? When i try to run an example code like below, i get an error message that says:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 886, in publish
raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field joint_names must be a list or tuple type. Only uint8[] can be a string
I've allowed the interface to affect only one joint, by adding allow_partial_joints_goal: true
to the yaml file, because I want to move only one joint with each action and it seemed a simpler solution.
Also, is there anything that is also needed for this to work?
I guess at first I was thinking this could be written as:
vel_pub = rospy.Publisher('/gripper/joint_trajectory_controller/command', JointTrajectory, queue_size=5)
# rest of the code
if action == 0: #DOWN
vel_cmd = JointTrajectory()
vel_cmd.joint_names = "gripper_dummy_prismatic_joint"
vel_cmd.points = JointTrajectoryPoint()
vel_cmd.points.velocities = 0.1
self.vel_pub.publish(vel_cmd)