brics_actuator.msg only works with rostopic
Hello,
I'm fairly new to ROS and the youBot. I'm trying to move Joint 1 of the arm. A notebook is connected via ssh to the youBot. When I use rostopic everything works as expected and the arm moves.
rostopic pub -1 /arm_1/arm_controller/position_command brics_actuator/JointPositions '{positions:[{joint_uri: arm_joint_1, unit: rad, value: 2}]}
ros_graph looks like this:
/rostopic_3016_lotofnumbers -> /arm_1/arm_controller/position_command -> /youbot_driver
Now I tried my own program "ArmVorlage".py, but it isn't moving:
class Goto_Searchposition():
def __init__(self):
# Give the node a name
self.node_name = "goto_searchposition"
# Set rospy to execute a shutdown function when exiting
rospy.on_shutdown(self.shutdown)
self.pub = rospy.Publisher("/arm_1/arm_controller/position_command", brics_actuator.msg.JointPositions)
rospy.init_node("goto_searchposition")
joint_positions = brics_actuator.msg.JointPositions()
JointValue = brics_actuator.msg.JointValue()
JointValue.joint_uri='arm_joint_1'
JointValue.unit = 'rad'
JointValue.value = 2
joint_positions.positions.append(JointValue)
self.pub.publish(joint_positions)
rospy.sleep(1)
rospy.loginfo(str(joint_positions))
def shutdown(self):
# Always stop the robot when shutting down the node.
rospy.loginfo("Stopping the robot...")
if __name__ == '__main__':
Goto_Searchposition()
rospy.spin()
ros_graph looks like this:
/goto_searchposition -> /arm_1/arm_controller/position_command -> /youbot_driver
The debugging in /youbot_driver looks similiar except the ports are different and these logs are missing when running my own program:
[DEBUG] [1399616158.709991323]: Command for arm1 received
[DEBUG] [1399616158.710137675]: Arm ID is: youbot-manipulator
I would be very grateful if you could help me.
Regards
Timo (I'm sorry i cant post pictures or links cause as a new user i have too little karma)
I have a similar doubt. Though I am getting a different error. Will just "from brics_actuator import JointPosition" work? I just made a python script and get this: http://answers.ros.org/question/173395/controlling-youbots-arm-brics_actuatorjointpositions/ youbot@youbot-desktop:~$ rosrun youbot_leap leap_armcontrol.py Traceback (most recent call last): File "/home/youbot/catkin_ws/src/youbotleap/scripts/leap_armcontrol.py", line 96, in <module> sender() File "/home/youbot/catkin_ws/src/youbotleap/scripts/leap_armcontrol.py", line 25, in sender msg.positions.joint_uri = "arm_joint_1" AttributeError: 'list' object has no attribute 'joint_uri'