Skip to content

Conversation

@asiancooki
Copy link
Contributor

sending 1500us to thursters at shutdown from thurster ks or any shutdown

Refactored error_loop and callback functions, added initialization for microseconds array on reset, and ensured safety before destroying entities.

In power_setup() (line ~242): Initializes the microseconds array immediately after the message buffer initialization. This ensures that when the Teensy resets (kill switch pulled/reinserted), the thrusters start at neutral (1500) before any ROS commands arrive.​

In create_entities() (line ~155): Resets the microseconds array when ROS entities are created/reconnected. This handles the case where the ROS node on your host computer didn't die but the Teensy did—old commands from the still-running node won't override the safe 1500 value until new commands arrive.​

In destroy_entities() (line ~171): Sets thrusters to 1500 before calling offCommand for extra safety during disconnection.

…thrusters at shutdown from thurster ks or any shutdown

Refactored error_loop and callback functions, added initialization for microseconds array on reset, and ensured safety before destroying entities.

In power_setup() (line ~242): Initializes the microseconds array immediately after the message buffer initialization. This ensures that when the Teensy resets (kill switch pulled/reinserted), the thrusters start at neutral (1500) before any ROS commands arrive.​

In create_entities() (line ~155): Resets the microseconds array when ROS entities are created/reconnected. This handles the case where the ROS node on your host computer didn't die but the Teensy did—old commands from the still-running node won't override the safe 1500 value until new commands arrive.​

In destroy_entities() (line ~171): Sets thrusters to 1500 before calling offCommand for extra safety during disconnection.

Signed-off-by: Yau Chau <[email protected]>
…ally rearm the thrusters to 1500us. This means that if one crashes a CLI publisher node, it will actually rearm the thrusters correctly.
@asiancooki
Copy link
Contributor Author

Tweaked the Teensy power node to be safer and easier to debug.

Added a propulsion “watchdog” that forces all thrusters to 1500 µs if no /propulsion/microseconds command is received for a while (currently 2 s, configurable in code).

Watchdog is non-blocking and only kicks in once per timeout window, so it does not fight normal commands or cut short 1 s maneuvers.

When a new propulsion message comes in, the watchdog is reset and normal control resumes.

Added a /power/state string topic to echo the micro-ROS connection state (WAITING_AGENT, AGENT_CONNECTED, etc.) for easier debugging on the host.

Kept all existing publishers, timers, and thruster logic intact; changes are mostly wiring in the timeout + state echo around the existing state machine.

Tested with dry runs by:

Sending step commands on /propulsion/microseconds and checking the thrusters follow for the full duration.

Stopping commands and confirming the system falls back to 1500 µs on all channels.

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.

3 participants