dynamixel_controllers tutorial issue: Waiting for joint trajectory action
Hello, I am fairly new to ROS and have recently gone through beginner tutorials. I'm using ROS kinetic 1.12.2 on Ubuntu 16.04.3 LTS (and kernal name 4.13.0-32-generic).
I am following the tutorial for dynamixel_contollers as posted on http://wiki.ros.org/dynamixel_controllers/Tutorials. I have 3 dynamixels that I've been using: 2 mx-106 and 1 mx-64. They are daisy chained.
I have been able to make all of the tutorials work, except Creating a dynamixel action client controller. In particular, when I execute the python script the tutorial provides, trajectory_client.py, my terminal hangs up "waiting for joint trajectory action" as such:
robert:scripts$ python trajectory_client.py
[INFO] [1520631936.725541]: Waiting for joint trajectory action
I will post all of the relevant code below. Looking at actionlib documentation and the tutorial python code, I see that waitforserver() must be activated but is not connecting to the action server. I'm not sure why.
Here is my tilt.yaml file:
joint3_controller:
controller:
package: dynamixel_controllers
module: joint_position_controller
type: JointPositionController
joint_name: claw_1f
joint_speed: 1.0
motor:
id: 1
init: 0
min: 0
max: 4095
joint4_controller:
controller:
package: dynamixel_controllers
module: joint_position_controller
type: JointPositionController
joint_name: traction_1f
joint_speed: 1.0
motor:
id: 2
init: 0
min: 0
max: 2047
joint5_controller:
controller:
package: dynamixel_controllers
module: joint_position_controller
type: JointPositionController
joint_name: joint_1f
joint_speed: 1.0
motor:
id: 3
init: 0
min: 0
max: 4095
Here is my startmetacontroller.launch:
<launch>
<!-- Start tilt joint controller -->
<rosparam file="$(find my_dynamixel_tutorial)/config/tilt.yaml" command="load"/>
<node name="controller_spawner" pkg="dynamixel_controllers" type="controller_spawner.py"
args="--manager=dxl_manager
--port pan_tilt_port
joint3_controller
joint4_controller
joint5_controller
"
output="screen"/>
<!-- Start joints trajectory controller controller -->
<rosparam file="$(find my_dynamixel_tutorial)/config/joints_trajectory_controller.yaml" command="load"/>
<node name="controller_spawner_meta" pkg="dynamixel_controllers" type="controller_spawner.py"
args="--manager=dxl_manager
--type=meta
f_arm_controller
joint3_controller
joint4_controller
joint5_controller
"
output="screen"/>
</launch>
Here is my python code
#!/usr/bin/env python
import roslib
roslib.load_manifest('my_dynamixel_tutorial')
import rospy
import actionlib
from std_msgs.msg import Float64
import trajectory_msgs.msg
import control_msgs.msg
from trajectory_msgs.msg import JointTrajectoryPoint
from control_msgs.msg import JointTrajectoryAction, JointTrajectoryGoal, FollowJointTrajectoryAction, FollowJointTrajectoryGoal
class Joint:
def __init__(self, motor_name):
#arm_name should be b_arm or f_arm
self.name = motor_name
self.jta = actionlib.SimpleActionClient('/'+self.name+'_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
rospy.loginfo('Waiting for joint trajectory action')
self.jta.wait_for_server()
rospy.loginfo('Found joint trajectory action!')
def move_joint(self, angles):
goal = FollowJointTrajectoryGoal()
char = self.name[0] #either 'f' or 'b'
goal.trajectory.joint_names = ['claw_1f'+char, 'traction_1f'+char,'joint_1f'+char]
point = JointTrajectoryPoint()
point.positions = angles
point.time_from_start = rospy.Duration(3)
goal.trajectory.points.append(point)
self.jta.send_goal_and_wait(goal)
def main():
arm = Joint('f_arm_controller')
arm.move_joint([0.5,1.5,1.0])
arm.move_joint([6.28,3.14,6.28])
if __name__ == '__main__':
rospy.init_node('joint_position_tester')
main()
Here is my jointstrajectorycontroller.yaml:
#groups all controllers and makes into action server.
f_arm_controller:
controller:
package: dynamixel_controllers
module: joint_trajectory_action_controller
type: JointTrajectoryActionController
joint_trajectory_action_node:
min_velocity: 0.1
constraints:
goal_time: 0.25
#. The goal_time parameter in the changes only the time period between each action and does not interfere with the motor's velocity.
Lastly, here's my manifest:
<?xml version="1.0"?>
<package format="2">
<name>my_dynamixel_tutorial</name>
<version>0.0.0</version>
<description>The my_dynamixel_tutorial package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="robert@todo.todo">robert</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>dynamixel_controllers</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>dynamixel_controllers</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>dynamixel_controllers</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<!-- Added dependencies for the tutorial below -->
<build_depend>control_msgs</build_depend>
<build_export_depend>control_msgs</build_export_depend>
<exec_depend>control_msgs</exec_depend>
<build_depend>trajectory_msgs</build_depend>
<build_export_depend>trajectory_msgs</build_export_depend>
<exec_depend>trajectory_msgs</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
Asked by RobotRob on 2018-03-09 17:14:52 UTC
Comments
I figured it out. It turns out that removing _controller from the self.jta = actionlib.SimpleActionClient call in the python script did the trick. The names in the tutorial files did not match. Small things ugh.
Asked by RobotRob on 2018-03-10 17:43:05 UTC
Hello, good morning. Could you tell me how you have solved this problem? Thank you very much.
Asked by Montes on 2018-03-19 04:12:53 UTC
I changed the line self.jta = actionlib.SimpleActionClient('/'+self.name+'_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
to self.jta = actionlib.SimpleActionClient('/'+self.name+'/follow_joint_trajectory', FollowJointTrajectoryAction).
Ie. I just removed the _controller.
Asked by RobotRob on 2018-03-19 08:32:00 UTC
Thank you very much. The problem is that I have all the files like you and I see the following error in the console where I run controller_manager: Incoming trajectory joints do not match the joints of the controller. Exception in your execute callback: not all arguments converted during string...
Asked by Montes on 2018-03-19 11:06:14 UTC