dynamixel_controllers tutorial issue: Waiting for joint trajectory action

asked 2018-03-09 16:14:52 -0500

RobotRob gravatar image

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 wait_for_server() 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 start_meta_controller.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 joints_trajectory_controller.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 ...
(more)
edit retag flag offensive close merge delete

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.

RobotRob gravatar image RobotRob  ( 2018-03-10 16:43:05 -0500 )edit

Hello, good morning. Could you tell me how you have solved this problem? Thank you very much.

Montes gravatar image Montes  ( 2018-03-19 04:12:53 -0500 )edit

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.

RobotRob gravatar image RobotRob  ( 2018-03-19 08:32:00 -0500 )edit

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...

Montes gravatar image Montes  ( 2018-03-19 11:06:14 -0500 )edit