ROBOTIS-GIT / OpenCR

Software for ROS Embedded board (a.k.a. OpenCR). OpenCR means Open-source Control Module for ROS.
Apache License 2.0
383 stars 238 forks source link

RC-100::available() requires a warm up call. #333

Open ruddyscent opened 10 months ago

ruddyscent commented 10 months ago

I am modifying the sketch for Turtlebot3-waffle to use four wheels. While working on it, I noticed that the RC-100 only recognizes the joystick intermittently. I found a workaround but couldn't find the cause, so I created this issue.

In my case, running rc100_.available() before the availability check solves the RC-100's responsiveness problem, like the following code snippet:

void Turtlebot3Controller::getRCdata(float *get_cmd_vel)
{
  ...
  rc100_.available(); // Warm up
  if (rc100_.available())
  {
    received_data = rc100_.readData();