f1tenth-dev / simulator

ROS & Gazebo F1/10 Autonomous Racecar Simulator
Apache License 2.0
77 stars 32 forks source link

keyboard teleop in gazebo #4

Closed karolmajek closed 5 years ago

karolmajek commented 5 years ago

Hi,

I have already installed the sim, without any problems in 5 minutes (!) I tried:

roslaunch f1tenth-sim simulator.launch run_gazebo:=true keyboard_control:=true

I get an empty world in gazebo with yellow car and asphalt plane (no track). When I press WASD I receive on /car_1/command following msgs:

---------- 28.10.2019 11:46:11.035356 --------------------
steering_angle: 0.0
steering_angle_velocity: 0.0
speed: -0.5
acceleration: 0.0
jerk: 0.0
---------- 28.10.2019 11:46:11.155518 --------------------
steering_angle: -0.25
steering_angle_velocity: 0.0
speed: 0.5
acceleration: 0.0
jerk: 0.0

but the car doesn't move at all. The topic is subscribed by one node: /car_1/control_plugin

I will appreciate any help, Karol

varundevsukhil commented 5 years ago

Hi Karol,

The most common reason for the race track to not appear is that the model files were not placed in the correct folders. We have provided more details about it here. Please check the directory of .gazebo/models/ to see if the race_track model exists. If not, copy the contents of the world directory in the git repo to the models directory. This should solve your first problem.

For the keyboard tele-operation, is the terminal from which the roslaunch command was issued active on your screen? The terminal must be active to read keyboard events and forward them to the racecar.

Let me know if this works and I will update the wiki to emphasize the need to do this.

karolmajek commented 5 years ago

That was it. I missed the First Time Setup

The terminal had focus, but it wasn't working. Now it works ok.

Thank you so much!

Resolved.

BTW I plan to use this sim to teach students and create an online competition soon.