New science board over CAN - #187
Merged
Merged
Conversation
ConnorNeed
approved these changes
Aug 3, 2026
ConnorNeed
reviewed
Aug 3, 2026
| ld.add_action(talon_container) | ||
| ld.add_action(esp_serial_bridge) | ||
| ld.add_action(science_sensors) | ||
| ld.add_action(polarimeter) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the science subsystem from an ESP/serial-based architecture to a CAN-based “science board” interface, introducing new ROS 2 messages and a new C++ science_sensors node that publishes sensor data and accepts actuator commands over SocketCAN.
Changes:
- Add new
science_sensorsC++ node (CAN rx/tx + polarimeter service) and convert thescience_sensorspackage toament_cmake. - Update
interfacesmessages for the new science board (ADC, motor/servo, DHT22) and adjust existing polarimeter message typing. - Update bringup/teleop configuration to use the new joystick mapping and CAN interface wiring (
can1), and remove legacy ESP/serial bridge + related launch/scripts.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Teleop-Control/joystick_control/config/3dpro.yaml | Updates drill axis mapping for the new joystick config. |
| src/interfaces/msg/ScienceServo.msg | Adds new servo command message for science board control. |
| src/interfaces/msg/ScienceMotor.msg | Simplifies motor command message fields for the new CAN protocol. |
| src/interfaces/msg/ScienceADC.msg | Adds new ADC readings message for science board telemetry. |
| src/interfaces/msg/PolarimeterSweep.msg | Updates polarimeter sweep message typing/comment for new implementation. |
| src/interfaces/msg/EspSensorReadings.msg | Removes legacy ESP serial sensor readings message. |
| src/interfaces/msg/DHT22.msg | Adds new temperature/humidity message type. |
| src/interfaces/CMakeLists.txt | Registers new messages and removes legacy ESP/PWM messages from interface generation. |
| src/HW-Devices/science_sensors/src/science_node.cpp | New CAN-backed science node implementation (pub/sub + polarimeter service). |
| src/HW-Devices/science_sensors/src/main.cpp | New C++ entrypoint to run the science node with the epoll CAN loop. |
| src/HW-Devices/science_sensors/setup.py | Removes console entrypoints for deleted legacy Python nodes. |
| src/HW-Devices/science_sensors/science_sensors/science_esp_code/science_esp.ino | Deletes legacy ESP firmware implementation (serial framing + PWM + sensors). |
| src/HW-Devices/science_sensors/science_sensors/science_esp_code/README.txt | Deletes legacy ESP firmware build/usage documentation. |
| src/HW-Devices/science_sensors/science_sensors/polarimeter.py | Deletes legacy Python polarimeter node implementation. |
| src/HW-Devices/science_sensors/science_sensors/gas_sensor.py | Deletes legacy Python gas sensor node implementation. |
| src/HW-Devices/science_sensors/science_sensors/esp_serial_bridge.py | Deletes legacy ESP serial bridge node implementation. |
| src/HW-Devices/science_sensors/package.xml | Switches package build type to ament_cmake and adds C++ dependencies. |
| src/HW-Devices/science_sensors/launch/talon.launch.py | Removes legacy launch file. |
| src/HW-Devices/science_sensors/launch/panoramic.launch.py | Removes legacy launch file. |
| src/HW-Devices/science_sensors/launch/gpio.launch.py | Removes legacy launch file. |
| src/HW-Devices/science_sensors/launch/gas_sensor.launch.py | Removes legacy launch file. |
| src/HW-Devices/science_sensors/launch/can_module_reader.launch.py | Removes legacy launch file. |
| src/HW-Devices/science_sensors/include/science_node.hpp | Adds C++ header for the new CAN-based science node. |
| src/HW-Devices/science_sensors/CMakeLists.txt | Adds ament_cmake build for the new C++ science_sensors executable. |
| src/Bringup/launch/science.launch.py | Updates bringup to use the new joystick config and launch the new science sensors node on can1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+19
| std::thread can_event_loop([&event_loop]() { event_loop.run_until_empty(); }); | ||
| rclcpp::spin(can_node); | ||
| can_node->deinit(); | ||
| rclcpp::shutdown(); | ||
| return 0; | ||
| } |
Comment on lines
+174
to
+188
| void ScienceNode::motor_callback() { | ||
| struct can_frame frame; | ||
| frame.can_id = node_id_ << 5 | CmdId::SetMotor; | ||
| { | ||
| std::lock_guard<std::mutex> guard(motor_mutex_); | ||
| frame.data[0] = motor_msg_.pin; | ||
| frame.data[1] = motor_msg_.duty_cycle; | ||
| frame.data[2] = (motor_msg_.duration >> 8) & 0xff; | ||
| frame.data[3] = motor_msg_.duration & 0xff; | ||
| frame.data[4] = (motor_msg_.ramp >> 8) & 0xff; | ||
| frame.data[5] = motor_msg_.ramp & 0xff; | ||
| } | ||
| frame.can_dlc = 6; | ||
| can_intf_.send_can_frame(frame); | ||
| } |
Comment on lines
+215
to
+220
| std::unique_lock<std::mutex> guard(polar_mutex_); | ||
| if (polar_cond_.wait_for( | ||
| guard, std::chrono::seconds( | ||
| this->get_parameter("sweep_timeout").as_int())) == | ||
| std::cv_status::timeout) { | ||
| response->success = false; |
Comment on lines
+1
to
+5
| #include "science_node.hpp" | ||
|
|
||
| #include <fcntl.h> | ||
| #include <sys/stat.h> | ||
|
|
codeflight1
force-pushed
the
new-science
branch
from
August 3, 2026 01:51
4dbdcf3 to
e25b23b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.