ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how publish joint velocity command?

asked 2021-03-19 08:04:40 -0600

FedeBO gravatar image

updated 2021-03-19 11:56:20 -0600

gvdhoorn gravatar image

ROS MELODIC, GAZEBO 9 Hi, i'm working to set up a quadcopter simulation within gazebo. I have created the model and added 4 transmission element ( one for each motor ) and to control them i use the ros_control plugins. Thus, i have created a file.yaml in which i specify my controllers:

joint_motor_controller:
    type: velocity_controllers/JointGroupVelocityController
    joints: 
        - joint_front_right_prop
        - joint_front_left_prop
        - joint_back_left_prop
        - joint_back_right_prop
    gains:
        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}

the problem arise when i try to publish from a ros node the velocity. the publisher objects is :

ros::Publisher pub = n.advertise<std_msgs::Float64MultiArray("/drone/joint_motor_controller/command",4);

but when i run the node i get the node i get the following error in gazebo:

ERROR: dimension of command ( #) does not match number of joint (4).

any help??? thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-19 12:33:33 -0600

The type of data you are publishing is a Float64 array but you are only sending a single value "4". Try publishing an array (values in square brackets). So maybe [4] instead of 4 if you are trying to send a single value

edit flag offensive delete link more

Comments

Thanks for your answer, i have already fix it on my own. I was publishing a float64array without specifing the dimension. I simply use the resize() method :)))

FedeBO gravatar image FedeBO  ( 2021-03-22 16:38:12 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2021-03-19 08:04:40 -0600

Seen: 634 times

Last updated: Mar 19 '21