diff --git a/arduino/opencr_arduino/opencr/libraries/turtlebot3/include/turtlebot3/turtlebot3_controller.h b/arduino/opencr_arduino/opencr/libraries/turtlebot3/include/turtlebot3/turtlebot3_controller.h index cee88d37..2c1f1195 100644 --- a/arduino/opencr_arduino/opencr/libraries/turtlebot3/include/turtlebot3/turtlebot3_controller.h +++ b/arduino/opencr_arduino/opencr/libraries/turtlebot3/include/turtlebot3/turtlebot3_controller.h @@ -30,6 +30,10 @@ #define DEBUG_SERIAL SerialBT2 +namespace Internal { + static uint16_t dummy_raw_data_; +} + class Turtlebot3Controller { public: @@ -38,7 +42,7 @@ class Turtlebot3Controller bool init(float max_lin_vel, float max_ang_vel, uint8_t scale_lin_vel = 1, uint8_t scale_ang_vel = 1); - bool getRCdata(float *get_cmd_vel); + bool getRCdata(float *get_cmd_vel, uint16_t &raw_data = Internal::dummy_raw_data_); private: geometry_msgs::Twist cmd_vel_; diff --git a/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp b/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp index 3d9cf1fd..8ed4f789 100644 --- a/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp +++ b/arduino/opencr_arduino/opencr/libraries/turtlebot3/src/turtlebot3/turtlebot3_controller.cpp @@ -45,7 +45,7 @@ bool Turtlebot3Controller::init(float max_lin_vel, float max_ang_vel, uint8_t sc return true; } -bool Turtlebot3Controller::getRCdata(float *get_cmd_vel) +bool Turtlebot3Controller::getRCdata(float *get_cmd_vel, uint16_t &raw_data) { uint16_t received_data = 0; bool clicked_state = false; @@ -55,6 +55,8 @@ bool Turtlebot3Controller::getRCdata(float *get_cmd_vel) if (rc100_.available()) { received_data = rc100_.readData(); + if (&raw_data != &Internal::dummy_raw_data_) + raw_data = received_data; if (received_data & RC100_BTN_U) { @@ -102,4 +104,4 @@ bool Turtlebot3Controller::getRCdata(float *get_cmd_vel) } return clicked_state; -} \ No newline at end of file +} diff --git a/arduino/opencr_arduino/opencr/platform.txt b/arduino/opencr_arduino/opencr/platform.txt index a2ba0f92..237b9dbe 100755 --- a/arduino/opencr_arduino/opencr/platform.txt +++ b/arduino/opencr_arduino/opencr/platform.txt @@ -81,7 +81,7 @@ recipe.s.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mcpu={b ## Create archives recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--whole-archive {compiler.libraries.ldflags} "{build.path}/{archive_file}" -Wl,--no-whole-archive -Wl,--end-group +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--whole-archive "{build.path}/{archive_file}" -Wl,--no-whole-archive {compiler.libraries.ldflags} -Wl,--end-group ## Create eeprom recipe.objcopy.eep.pattern=