0
$\begingroup$

Rosanswers logo

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?


Originally posted by mth_sousa on ROS Answers with karma: 35 on 2023-07-03

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I manually set the velocity from joint_states topic


Originally posted by mth_sousa with karma: 35 on 2023-07-06

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.