ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found the solution.

The .yaml file must be as follows:

    type: joint_state_controller/JointStateController
    publish_rate: 50
    type: velocity_controllers/JointGroupVelocityController
        - joint_front_right_prop
        - joint_front_left_prop
        - joint_back_left_prop
        - joint_back_right_prop
    joint_front_right_prop: {p: 10000, i: 1, d: 1000}
    joint_front_left_prop: {p: 10000, i: 1, d: 1000}
    joint_back_left_prop: {p: 10000, i: 1, d: 1000}
    joint_back_right_prop: {p: 10000, i: 1, d: 1000}

Make sure to change "joint" to "joints". These must include the joints you have defined in the .xacro file. In my case, it is joint_front_right_prop, joint_front_left_prop, joint_back_left_prop, joint_back_right_prop.

Also, my launch file is:

<node name="control_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="--namespace=/Kwad joint_state_controller 
                         joint_motor_controller" />

This launches all four joints at the same time, and SIMULTANEOUSLY publishes velocities to these four joints.

The command initially was:

rostopic pub -1 /Kwad/joint_front_right_prop/command std_msgs/Float64 "data: 10"

I had to repeat this command 4 times for 4 different joints. Now it is the follows. One command for four joints.

rostopic pub -1 /Kwad/joint_motor_controller/command std_msgs/Float64MultiArray "data: [10, 10, 10, 10]"

This publishes velocity of 10 units (in Gazebo world) to all the 4 joints, SIMULTANEOUSLY.

I hope this helps anyone in need. Thank you!!