Skip to content

refactor: modernize roborts_base & roborts_decision to C++17#60

Open
SkyPhy wants to merge 2 commits intoRoboMaster:icra2019from
SkyPhy:ros
Open

refactor: modernize roborts_base & roborts_decision to C++17#60
SkyPhy wants to merge 2 commits intoRoboMaster:icra2019from
SkyPhy:ros

Conversation

@SkyPhy
Copy link

@SkyPhy SkyPhy commented Mar 12, 2026

roborts_base (18 files)

Bug Fixes

  • Fix DLOG_ERROR mapped to DLOG(WARNING) instead of DLOG(ERROR) (log.h)
  • Fix impossible null check: port_name_.c_str() == nullptr (serial_device.cpp)
  • Fix baudrate array bounds mismatch: st_baud[8] vs std_rate[11] (serial_device.cpp)
  • Fix non-portable sizeof(std_rate)/4 -> sizeof(std_rate)/sizeof(std_rate[0])
  • Fix verison_client_ typo -> version_client_ (chassis.h/cpp, gimbal.h/cpp)

Build System

  • Upgrade C++ standard from C++14 to C++17
  • Bump cmake_minimum_required to 3.10
  • Upgrade package.xml to format 2, remove unused rospy dependency

Modern C++ Updates

  • Add constexpr conversion constants (mm<->m, decideg<->rad)
  • Replace raw magic numbers with named constants
  • Use std::make_shared instead of raw new (dispatch.h)
  • Replace C-style (MemoryBlock*)0 with nullptr (memory_pool.h)
  • Fix bool full_ = 0 -> false (circular_buffer.h)
  • Add missing include (hardware_interface.h)
  • Use const char* instead of char* (log.h GLogWrapper)
  • Add signal handling and configurable loop rate (roborts_base_node.cpp)
  • Expand config with loop_rate and module enable flags

roborts_decision (13 files)

Bug Fixes

  • Fix FastLineIterator using robot_cell_x for both y coords (chase_behavior.h)
  • Fix whirl_vel_.accel.linear.x initialized twice (escape_behavior.h)
  • Fix uninitialized new_goal_ member (blackboard.h)
  • Fix undefined behavior: patrol_count_ = ++patrol_count_ % n (patrol_behavior.h)

Thread Safety

  • Add std::mutex protection for enemy_detected_, enemy_pose_ (blackboard.h)
  • Add std::mutex protection for new_goal_, goal_ (blackboard.h)

Code Quality

  • Replace raw new with std::make_unique (behavior_test.cpp)
  • Replace std::cout with ROS_DEBUG logging (patrol_behavior.h)
  • Upgrade package.xml to format 2

SkyPhy added 2 commits March 8, 2026 18:21
## roborts_base (18 files)

### Bug Fixes
- Fix DLOG_ERROR mapped to DLOG(WARNING) instead of DLOG(ERROR) (log.h)
- Fix impossible null check: port_name_.c_str() == nullptr (serial_device.cpp)
- Fix baudrate array bounds mismatch: st_baud[8] vs std_rate[11] (serial_device.cpp)
- Fix non-portable sizeof(std_rate)/4 -> sizeof(std_rate)/sizeof(std_rate[0])
- Fix verison_client_ typo -> version_client_ (chassis.h/cpp, gimbal.h/cpp)

### Build System
- Upgrade C++ standard from C++14 to C++17
- Bump cmake_minimum_required to 3.10
- Upgrade package.xml to format 2, remove unused rospy dependency

### Modern C++ Updates
- Add constexpr conversion constants (mm<->m, decideg<->rad)
- Replace raw magic numbers with named constants
- Use std::make_shared instead of raw new (dispatch.h)
- Replace C-style (MemoryBlock*)0 with nullptr (memory_pool.h)
- Fix bool full_ = 0 -> false (circular_buffer.h)
- Add missing <cstdint> include (hardware_interface.h)
- Use const char* instead of char* (log.h GLogWrapper)
- Add signal handling and configurable loop rate (roborts_base_node.cpp)
- Expand config with loop_rate and module enable flags

## roborts_decision (13 files)

### Bug Fixes
- Fix FastLineIterator using robot_cell_x for both y coords (chase_behavior.h)
- Fix whirl_vel_.accel.linear.x initialized twice (escape_behavior.h)
- Fix uninitialized new_goal_ member (blackboard.h)
- Fix undefined behavior: patrol_count_ = ++patrol_count_ % n (patrol_behavior.h)

### Thread Safety
- Add std::mutex protection for enemy_detected_, enemy_pose_ (blackboard.h)
- Add std::mutex protection for new_goal_, goal_ (blackboard.h)

### Code Quality
- Replace raw new with std::make_unique (behavior_test.cpp)
- Replace std::cout with ROS_DEBUG logging (patrol_behavior.h)
- Upgrade package.xml to format 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant