Skip to content

Gro501-APP2-A26 clean-up and update - #67

Open
alx87grd wants to merge 14 commits into
ros2from
gro501
Open

alx87grd wants to merge 14 commits into
ros2from
gro501

Conversation

@alx87grd

Copy link
Copy Markdown
Collaborator
  • small clean-up in teleop/controller python scripts
  • New improved low-level communication from the Arduino to row

alx87grd and others added 14 commits September 9, 2026 16:58
Give one signal catalog and minilink-style ctl(x, r, t, params) placeholders so students can paste K without changing the default open-loop zeros. Still needs a run on the real car.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mode 4 left a false speed spike on the next tick; the Hz comments did not match the loop tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
… storage.

Topics without a header were stored in nanoseconds, mixed with header stamps in seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>
millis() on the Mega counts 1.024 ms ticks and skips a value every 42.7 ms,
so an integer-ms dt_low makes the raw speed read 25 to 33 % low on some ticks
and after each blocking publish. Swapping the 4 tagged lines on the car passes
a float dt in ms measured with micros() to ctl(); the loop rate is unchanged.
Comments only: the compiled behaviour is identical until the lines are swapped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…serial send.

Test branch. The millis() time base gave a ~3.07 ms tick (not 2 ms) and speed dips
of 25-33 %, and Serial.flush() plus a 64-byte TX buffer froze loop() ~14 ms per
publish. Now: time base in us (2 ms tick, 25 ms publish, 1 s watchdog), float dt in
ms to ctl(), data[8] still in ms for GRO830, no flush and a 256-byte TX buffer
(platformio.ini). Debug: the PAUSE line publishes the sensorsCallback duration in
data[7]; the PBSEND line switches to a pbSend that sends the same bytes without
String/sprintf, for when that duration is too long. Host-tested only, no AVR build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Measured on a cycle-accurate ATmega2560 (simavr, 16 MHz) with realistic values:
9.7 ms for the String/sprintf pbSend and 1.8 ms for the fast one (0.4 ms encoding,
0.3 ms hex, 1.0 ms queuing the 161 chars), not the 0.2 ms first estimated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
validated 500 hz control loop and 50 hz com

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The teleop callback can access unvalidated buttons, and the optimized protobuf sender regresses multi-message frames.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Cleans up controller/teleoperation scripts and improves Arduino-to-ROS communication timing and throughput.

Changes:

  • Updates joystick mappings, controller templates, and documentation.
  • Adds faster protobuf serialization and non-blocking serial transmission.
  • Improves timing units, odometry data, and rosbag timestamp handling.
File Description
README.md Updates controller mode documentation.
racecar_teleop/​racecar_teleop/​slash_teleop.py Cleans up teleoperation logic and remaps fixed-speed mode.
racecar_autopilot/​racecar_autopilot/​wall_estimator.py Corrects a wall-estimation comment.
racecar_autopilot/​racecar_autopilot/​slash_controller.py Restructures controller templates and parameters.
racecar_autopilot/​racecar_autopilot/​rosbag2csv.py Adds storage auto-detection and consistent timestamps.
racecar_arduino/​Controller/​src/​PBUtils.cpp Adds optimized protobuf frame serialization.
racecar_arduino/​Controller/​src/​main.cpp Reworks control, communication, and watchdog timing.
racecar_arduino/​Controller/​platformio.ini Enlarges the serial transmission buffer.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

void PBUtils::pbSend(int nbs, ...)
{
static const char hexDigits[] = "0123456789ABCDEF";
char frame[2 * MAX_MSG_LEN + 16]; // "<" + id + "|" + 2 hex chars per byte + ";" + ">" (on the stack)
Comment on lines +41 to +43
self.get_logger().info(
"slash_teleop: Received topic doesn't have enough axes and/or buttons. If a Logitech gamepad is used, make sure also it is in X mode. Will not warn again."
)
Comment thread README.md
Comment on lines +113 to +114
7|`LB` + `R3`| Empty Template
8|`LB` + `Cross key Up/Down`| Empty Template
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.

2 participants