Gazebo | Ignition | Community
Ask Your Question
0

[Project template] keyboard control not working

asked 2023-07-05 12:40:01 -0600

Simple Simpson gravatar image

updated 2023-07-05 12:45:43 -0600

I would like to control the diff drive from the templates' bringup example, by keyboard.

The recipe I have followed:

https://gazebosim.org/docs/garden/mov...

I can see the keystroke data in a terminal using gz topic -e -t /keyboard/keypress, when I press keys from within the active simulation, with KeyPublisher plugin activated. I have placed the TriggeredPublisher plugins under the world tag in diff_drive.sdf. For example

<!-- Moving Forward-->
<plugin filename="gz-sim-triggered-publisher-system"
  name="gz::sim::systems::TriggeredPublisher">
  <input type="gz.msgs.Int32" topic="/keyboard/keypress">
    <match field="data">16777235</match>
  </input>
  <output type="gz.msgs.Twist" topic="/cmd_vel">
    linear: {x: 0.5}, angular: {z: 0.0}
  </output>
</plugin>

I'm pretty sure I got the key mapping right in the plugins. I also make sure to colcon build and . install/setup.sh after any changes in the .sdf file.

Anyhow the robot does not move at all in the simulation. Am I using the wrong topics, since they come from a unrelated tutorial?

EDIT: I can see the cmd_vel messages from the keystrokes using gz topic -e -t /cmd_vel in a fresh shell. Example:

linear {
  x: 0.5
}
angular {
}

Still, the robot does not move.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-05 14:35:35 -0600

Simple Simpson gravatar image

The correct topic for the template diff drive is

/model/diff_drive/cmd_vel

as it stands in the comments of the diff_drive.sdf file.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-07-05 12:40:01 -0600

Seen: 182 times

Last updated: Jul 05 '23