-
Couldn't load subscription status.
- Fork 0
Example of webots with ros integration #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Should we convert the cpp files to python or keep the separation? Is it normal to have both languages collaborating together? I don't think it'll be a huge problem later down the line but it's good to set a standard early on for what we want to expect moving forward. |
|
I think the separation will be fine, based on the tutorial, the launch file should be the only one that needs to be in python |
Instead of using a robot description thats directly in the .wbt file, the code now imports a .proto file which should make it easier to eventually get our cad converted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made a couple of comments on things, generally I feel like it's good enough for a merge from just one read of each of the files, although I haven't tested it on my system personally yet.
| controller_script, | ||
| '--robot-name=slugbot', | ||
| '--protocol=ipc', | ||
| '--port=1234', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be important to list this somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the addition of these types of files means we should consider IMGBot to optimize them
| <webots> | ||
| <device reference="ds_left" type="DistanceSensor"> | ||
| <ros> | ||
| <topicName>/left_sensor</topicName> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we should have a short discussion for what we want our sensor naming convention to be. likely we won't have too many so it shouldn't be difficult.
| if (left_sensor_value < 0.9 * MAX_RANGE || | ||
| right_sensor_value < 0.9 * MAX_RANGE) { | ||
| command_message->angular.z = -2.0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the current rover model can turn at 2 radians per second. It is a lot slower than this on my computer, but that could just be because the simulator is slow in general on this computer. If it runs better on your computer, can you time how long it takes to turn a certain angle and calculate its maximum angular velocity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 rads per second doesn't sound too outrageous to me. This can be flagged as a TODO until we get a real one to tune off of. Are you suggesting that the constant is unrealistic, or rather that the sim isn't able to 'keep up' with the constant, making it meaningless/incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the numbers in the code since my previous comment.
The maxVelocity in SlugRobot.proto is 0.6rad/s for each wheel, which is equal to 0.015m/s based on the wheel radius in SlugbotDriver.cpp. When rotating at max velocity, this means the robot can rotate at 0.3333rad/s. This robot is very small compared to our rover (9cm wide) and very slow. This means that attempting to rotate at 2rad/s will basically override any reasonable input and make the robot turn in place at its maximum velocity until it isn't pointing at the wall. This causes it to not hit the wall, but I don't think this is what the code is intended to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly, there is a mismatch between the proto description and the constant in the code. As I try to conceptualize it, .6rad/s sounds pretty slow for a wheel, even though this 'robot' is pretty small. If it were an RC car, for example, it would be expected for it to move something like 1.5m/s, which I believe would correlate to 60rad/s, or 9.54 full rotations per second, given the same constants. ~10 rot/s doesn't sound unrealistic to me. This now begs the question as to where the SlugRobot.proto originally came from, and if it should be reevaluated based on some real motors that we can find online. Any motor works, it would just be for a proof of concept at this stage, anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say this is still approvable, even with my comment. It might merit adding a new issue for that specific documentation, but that shouldn't be a limiting factor to this specifically getting merged.
| name "FrontLeftWheel" | ||
| maxVelocity 60 | ||
| maxTorque 2 | ||
| maxTorque 0.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this change the interaction of the bot in the world? I haven't ran the sim myself yet, and it might be useful to have an example commented proto (this one?) which explains the parameters. Are these files generally automatically made or manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decreased the torque because it was causing it to rotate onto its back wheels and eventually fall. This value caused it to still have enough torque to accelerate without tipping. I changed this value again after fixing the robot width and wheel radius, so it is still able to drive around.
I don't know how this file was created; I just edited the motor speed and torque. However, I don't think anyone manually typed over 1000 lines of robot description.
This is a modified version of the ros tutorial that shows one way we could organize our code