Controlling youbot's arm. brics_actuator/JointPositions
I am trying to integrate leap motion sensor with youBot. I wrote a test publisher to move the joints. However, when I run the python script, I am getting this error:
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'
While through the terminal, it runs fine on the bot:
youbot@youbot-desktop:~/catkin_ws$ rostopic pub -1 /arm_1/arm_controller/position_command brics_actuator/JointPositions '{positions:[{joint_uri: arm_joint_5, unit: rad, value: 1}]}'
publishing and latching message for 3.0 seconds
The message:
youbot@youbot-desktop:~$ rosmsg show brics_actuator/JointPositions
brics_actuator/Poison poisonStamp
string originator
string description
float32 qos
brics_actuator/JointValue[] positions
time timeStamp
string joint_uri
string unit
float64 value
Here's the code:
import rospy
from brics_actuator.msg import JointPositions
pub_youbotleap_arm = rospy.Publisher('arm_1/arm_controller/position_command', JointPositions)
rospy.init_node('armcontrol')
rate = rospy.Rate(20)
msg = JointPositions()
msg.positions.joint_uri = "arm_joint_1"
msg.positions.unit = "rad"
msg.positions.value = 2
pub_youbotleap_arm.publish(msg)
if __name__ == '__main__':
sender()
rospy.spin()