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

How to get joint velocity from Moveit 2 Robot State?

asked 2023-07-03 14:24:09 -0600

mth_sousa gravatar image

Is it possible to get the velocity of each joint using Moveit 2 Robot State? Is there any better approach?

I tried the following:

robot_model_loader::RobotModelLoader robot_model_loader(node);
const moveit::core::RobotModelPtr& kinematic_model = robot_model_loader.getModel();
const moveit::core::JointModelGroup* joint_model_group = kinematic_model->getJointModelGroup("my_arm");
const moveit::core::RobotState current_robot_state = moveit::core::RobotState(kinematic_model);

auto velocities = current_robot_state.getVariableVelocities();
// velocities = garbage

std::vector<double> actualVelocity;
current_robot_state.copyJointGroupVelocities(joint_model_group, actualVelocity);
// actualVelocity = garbage also

I can get the joints positions without any problem. The velocity is published to /joint_states topic correctly.

The only solution is subscribe to /joint_states?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-06 13:48:20 -0600

mth_sousa gravatar image

I manually set the velocity from joint_states topic

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-07-03 14:24:09 -0600

Seen: 151 times

Last updated: Jul 06 '23