Skip to content

New science board over CAN - #187

Merged
codeflight1 merged 7 commits into
mainfrom
new-science
Aug 3, 2026
Merged

New science board over CAN#187
codeflight1 merged 7 commits into
mainfrom
new-science

Conversation

@codeflight1

Copy link
Copy Markdown
Contributor

No description provided.

@ConnorNeed
ConnorNeed requested a review from Copilot August 3, 2026 01:21
Comment thread src/Bringup/launch/science.launch.py Outdated
ld.add_action(talon_container)
ld.add_action(esp_serial_bridge)
ld.add_action(science_sensors)
ld.add_action(polarimeter)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No longer exists

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_sensors C++ node (CAN rx/tx + polarimeter service) and convert the science_sensors package to ament_cmake.
  • Update interfaces messages 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 thread src/Bringup/launch/science.launch.py Outdated
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 thread src/HW-Devices/science_sensors/src/science_node.cpp
Comment thread src/HW-Devices/science_sensors/CMakeLists.txt
Comment thread src/HW-Devices/science_sensors/include/science_node.hpp
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>

Comment thread src/HW-Devices/science_sensors/src/science_node.cpp
Comment thread src/HW-Devices/science_sensors/src/science_node.cpp
@codeflight1
codeflight1 merged commit 46a03bf into main Aug 3, 2026
@codeflight1
codeflight1 deleted the new-science branch August 3, 2026 01:52
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.

4 participants