Ask Your Question
0

Controlling youbot's arm. brics_actuator/JointPositions

asked 2014-06-11 07:07:35 -0600

updated 2014-06-11 08:05:08 -0600

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()
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-21 07:55:56 -0600

jsanch2s gravatar image

msg.positions is a list of brics_actuator.msg.JointValue messages. Thus, you should fill your message accordingly:

from brics_actuator.msg import JointValue

msg.positions = [brics_actuator.msg.JointValue()]
msg.positions[0].joint_uri = "arm_joint_1"
msg.positions[0].unit = "rad"
msg.positions[0].value = 2
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-11 07:07:35 -0600

Seen: 1,012 times

Last updated: Nov 21 '16