0
$\begingroup$

Gazebo Answers logo

Hi! I built my differential robot with urdf and I want to control it through cpp. My goal is to set velocity of each wheel joint of the two wheel joints 'manually'. in the github there are the files. Effort file can move the robot only straight. S how can I control the joint wheel velocity

image description image description

https://github.com/luberdis/gazebo.git


Originally posted by niki on Gazebo Answers with karma: 1 on 2018-11-07

Post score: 0


Original comments

Comment by nkoenig on 2018-11-07:
Can you describe what you have tried? Have you also checked that your robot model has good collision and inertia values? And, I highly recommend following these tutorials to get started building a robot in Gazebo: http://gazebosim.org/tutorials?cat=build_robot

$\endgroup$

2 Answers 2

0
$\begingroup$

Gazebo Answers logo

The tutorial on Setting Velocity on Joints and Links has a good overview of some of the options you have using C++.


Originally posted by chapulina with karma: 7504 on 2018-11-07

This answer was NOT ACCEPTED on the original site

Post score: 3

$\endgroup$
0
$\begingroup$

Gazebo Answers logo

I would like to complete in what @chapulina said with a hands on example. I created a two wheel robot and a plugin that implements two of the three methods explained.

Depending on what you want you can use the PID control or the simple one. PID are of course more realistic and perform much better in that sense, but you have the issues related to PIDs, specially gazebo getting really crazy if the values exceed what its physically possible.

If you just want something that moves, then you can use the NON PID option, which is directly moving the joints.

Also remember that if you only want to move a two wheeled robot, you always have the Differential Drive Option. But I understand that explaining how this is done opens the door to move any number of joints.

I created this super simple two wheeled robot: image description

I created a ModelPlugin, here you have the cpp code:

set_speed_joint_plugin.cpp

Here you have the model sdf using that plugin:

model.sdf

And here the world that we use:

simple.world

Here I leave you also the GIT with all the code:

The ROSJECT with the whole project ready to use

And a VIDEO explaining a bit more in detail each element of the plugin.

Hope it helped.


Originally posted by Duckfrost with karma: 209 on 2018-11-07

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by niki on 2018-11-20:
hi thanks for the offered help! I followed your code and I enrolled in the robotignite to attend the tutorials. I try to test your code at my local gazebo but it does not work even though I cahnged the world file so the robot is on the floor at 0.031 and the static is zero (false). Moreover I would be pleased to see a specific tutorial about cpp plug in because I built a controller to go to a specific point in space. So for exaple the input will be x=5, y= 4 and the robot should go there.

Comment by AbnerNiu on 2018-12-04:
thanks for your instructions. I have a SDF file with some mesh files(.dae file), then I upload mesh file to ROS development studio and follow your video to launch my robot model, but I am unable to implement it with the error of "Unable to load mesh", some model can be written in SDF file with rectangle and cylinder, but my robot model can only be implemented by importing mesh. Could you please give me some advice on the process of how to implement simulation with mesh in RDS? Thx in advance:)

$\endgroup$
1
  • $\begingroup$ I got a couple moderator flags calling this answer spam, but I'm not seeing how this is spam. If there's some justification please flag for moderator attention and leave a note and we can investigate, otherwise this looks like someone spending a lot of effort to leave some sample code. $\endgroup$
    – Chuck
    Aug 26, 2023 at 18:44

Your Answer

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