User Tools

Site Tools


Back to V-REP Main Page

We start from an Inventor CAD file off an RC car that we want to use as a cheap autonomous robot for educational purpose:

  1. Convert the CAD file to a format importable in V-REP
  2. Simplify the CAD to create the dynamic model
  3. Make dynamic model more realistic
  4. Add the CAD parts
  5. Program the ROS Interface
  6. Test
  7. Build the track
  8. Test again

The original CAD file of the RC car has been made on Inventor. It has been converted to a bunch of STL files, one for each part. As we will have to define ourselves the links in V-REP when building the dynamical model, we do not need to use the links defined in Inventor.

The dynamic model of the car is quite realistic, it models the steering bar and the gears between the motor and the rear wheels axis.

The V-REP file with only the dynamic model can be found here seance4_modele_realiste_dyn.ttt

We take all the parts from the CAD file and we import them as static objects in V-REP. Thanks to Jules's car body, the RC car looks now quite well in V-REP. However, to see the inside of the car and e.g. the moving gears, the car body opacity has been reduced (in color settings in V-REP).

The V-REP file is here seance4_modele_realiste.ttt. Another V-REP file can be usefull with car on a lifting bridge seance4_modele_realiste_pont_levage.ttt.

Now we can test that the car can be controlled by ROS. After starting roscore, we just update the topics with the rostopic pub command. The car is control, as we do it with th RC controller, by two topics :

  • /vrep_steer_angle : steering angle , from -20 to +20 degrees
  • /vrep_speed_motor : motor speed , in degrees/second (to be verified ?!?)

Here are some examples of commands :

rostopic pub -1 /vrep_steer_angle std_msgs/Float32 -- -20.0   
rostopic pub -1 /vrep_speed_motor std_msgs/Float32 -- 5    

The last file is the full V-REP file with the track : seance4_modele_realiste_et_piste.ttt. The track can be built and modified using Blender as explainedhere.

To import the track created by Blender in V-REP :

  • export the track from Blender using Wavefront (.obj) format, the exported file can be called create_track_bezier.obj
  • open a scene file with the RC car in V-REP (e.g. seance4_modele_realiste.ttt)
  • import create_track_bezier.obj using File→Import→Mesh… , select “1 unit represents 10 cm” and “Y vector is up” and click “OK”
  • (optional) rename “GateElement_…” to “Gates” and “TrackElement_..” to “Track”
  • remove the default floor “ResizableFloor_5_25”
  • select the “Gates” object , doucle click on the icon on the left, once the property window has appeared, click on “adjust color” to give a color to the gates.
  • select the “Track” object , doucle click on the icon on the left, once the property window has appeared, click on “show dynamic properties dialog” and select “Body is respondable”. (Warning : do not set “Body is dynamic” !!!). Close the warning message and close the “Rigid body dynamic window”.
  • in the property window, click on “adjust texture” and in the texture window click “load new texture” and select the texture file for the road. Here, we use the 2048×2048 image from texturelib website to have lines that the RC car can follow, but you can take any road texture image. Select “Max. 2048×2048” for the texture scale, set “apply mode” to “decal” and close texture dialog window.
  • you can add 45×45 meters green plane (add primitive shapes) and place it 10 cm below the track to have a background. If you have enough CPU power you can leave this green plane “dynamic” and “respondable” so that the car will not fall in the abysses when leaving the track.
  • if the car is not correctly oriented in the direction of the track, select “Chassis” object, then click on rotation icon, define the “Around-z” rotation angle and click “Z-rotate sel.”.
  • start the simulation in V-REP (make sure roscore was running before starting V-REP)

ToDo : create a collision form from the car body, now the collision is only done with the hidden elements of the dynamic model, it is OK for the wheels but not for the body of the car.

Back to top.

vrep/create-rc-car-robot.txt · Last modified: 2020/04/13 18:33 by admin