Mixing position and velocity commands in a drive base
I'm working on a model plugin for controlling an omnidirectional drive base with four powered caster wheels. I want to control the position of the steering joints and the velocity of the wheel joints. The problem with this setup is that the wheel joints refuse to move.
Consider the following piece of code which is part on the callback for the world update begin event:
if (joint_name.find("rotation") != std::string::npos) {
joint->SetPosition(0, command_msg_.desired.positions[i]);
} else {
joint->SetVelocity(0, command_msg_.desired.velocities[i]);
}
- If I execute the first branch for all joints, then all joints will move to the commanded positions
- If I execute the second branch for all joints, then all joints will move at the commanded velocity
- If I keep the if statement (I've confirmed that the right branch is executed for each joint), then the positions will be respected, but the velocities will not. ie the wheels do not rotate
Any ideas what might be going on here?