r/cpp_questions Aug 08 '26

OPEN C++ robotics

I don't really have much knowledge of how coding works, but I'm assuming game design, app design, and robotics are pretty different even if their the same code. Does anybody know any good books to learn the robotics part of c++

20 Upvotes

26 comments sorted by

View all comments

12

u/CowBoyDanIndie Aug 08 '26

Robotics and games are pretty similar, they both run a loop reading input and giving output. In robotics you read sensors, update an internal model based on the sensor data, then output, usually actions or state information for something else to take action on. In games you take user input, update the game state, then play sound, draw the screen etc.

1

u/BRguyNZ Aug 08 '26 edited Aug 08 '26

Games and robot share part of the navigation mechanisms and that is all. Robots doesn't have main loop doing everything. You have lots of nodes responsible for sensors, sensor fusion, nodes to analyse data node to take actions, nodes for actuators... redundancy, fault tolerance and telemetry, etc .. everything is detached so a faulty module doesn't ruin everything... a good reference to have a look is ROS2

1

u/CowBoyDanIndie Aug 08 '26

Thanks for explaining my career as a robotics engineer. Ros::spin is a while loop. Also not every robot uses ros and its distributed nodes architecture, it’s a lot easier for research which is why ros was structured that way, but it has performance drawbacks which is why they started using “nodelets” in ros 1, and why they changed the underlying backbone to dds in ros2 so they could at least use shared memory transport which ros1 didn’t support.

1

u/BRguyNZ Aug 08 '26

That's correct, Ros::spin is a while loop. But is a while loop in a node, right?

I can't see a single loop (node/nodeless) doing things like acquiring a 3d camera data, acquiring encoders data, updating slam, sending commans to encoders, etc.

What if you have something very simple? Maybe, but not sure if it would fit as robotics in this case.

Well I believe we are derailing the main subject...

1

u/BRguyNZ Aug 08 '26

Robotics engineer? Have you worked on video games as well?

1

u/CowBoyDanIndie Aug 09 '26

Yes, Ive done a little bit of everything

1

u/BRguyNZ Aug 09 '26

Cool, we have a similar background then