ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Turtlebot3 - how to work with various OpenCR sensors and actions

asked 2017-10-11 08:31:02 -0500

pitosalas gravatar image

updated 2017-10-22 20:20:36 -0500

The OpenCR board has various sensors and actions: User LED x 4 : LD3 (red), LD4 (green), LD5 (blue), Gyroscope 3Axis, Accelerometer 3Axis, Magnetometer 3Axis (MPU9250), User button x 2.

What's the best way to access them from a ROS node? I would like to be able to read the gyro, accelerometer, magnetometer, and user buttons, and activate the LEDs.

I see that Turtlebot3 Burger core source for OpenCR in Arduino IDE, there are 5 publishers and I see their message types https://github.com/ROBOTIS-GIT/turtle... but I can't find the actual code that publishes. I've downloaded what I think is all the source code but can't find the code that actually publishes. I must be blind!

Can someone indicate to me where that code is and/or where it is documented?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-10-19 23:16:16 -0500

Will Son gravatar image

updated 2017-10-22 21:02:30 -0500

Based on the Turtlebot3 Burger core source for OpenCR in Arduino IDE, there are 5 publishers.
One of them is sensor_state_pub that publishes button status, voltage level, encoder values on "sensor_state" topic. ( https://github.com/ROBOTIS-GIT/turtle... )
Similarly, imu_pub publishes IMU readings from OpenCR with "imu" topic.
You can subscribe these topics in order to receive data from OpenCR.

However, there is no subscriber in the OpenCR firmware nor publisher in RPi 3 Turtlebot3 source for LED control.
The latest OpenCR firmware already utilizes USER1~4 LEDs for TXD, RXD, Low Battery and ROS Connect indicator.
If you want to use these LEDs for other purpose from RPi3, you need to create publisher for LED topic in the RPi 3 and subscriber for the same in the OpenCR(with Arduino IDE) to control LED.

========Appended Answer==========
I'm sorry for the unclear explanation about the OpenCR firmware.
In Arduino IDE, if you opened turtlebot3_core from "File > Examples > turtlebot3 > turtlebot3_burger > turtlebot3_core", the "turtlebot3_core" tab will be opened in default.
In the same file, go to line #313 where you can find "void publishSensorStateMsg(void)" function.
This function is called within the main loop (line # 203) of the code.

edit flag offensive delete link more

Comments

I've edited the original question with some additional details.

pitosalas gravatar image pitosalas  ( 2017-10-22 20:17:43 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-10-11 08:31:02 -0500

Seen: 1,889 times

Last updated: Oct 22 '17