Conversation
…ad compatibility Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR converts the LifeTrac v25 control system from integer values (-100 to 100) to floating-point values (-1.0 to 1.0) to enable native compatibility with DroidPad and similar joystick interfaces.
- Updated all control data structures to use float instead of int
- Modified joystick conversion formulas and deadzone thresholds
- Added comprehensive DroidPad integration documentation
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lifetrac_v25_remote.ino | Updated ESP32 control data structures and joystick conversion to float range |
| lifetrac_v25_controller.ino | Modified Arduino Opta controller to accept float values and updated flow control mapping |
| ControlCommand.msg | Changed ROS2 message fields from int32 to float32 |
| mqtt_bridge_node.py | Updated validation logic to check ±1.0 range instead of ±100 |
| test_publisher.py | Updated ROS2 test sequences to use float values |
| mqtt_test.py | Updated MQTT test script with float values in demo sequences |
| README.md | Added DroidPad compatibility feature and documentation reference |
| INTEGRATION_OVERVIEW.md | Updated code examples to use new float value range |
| DROIDPAD_INTEGRATION.md | Added comprehensive integration guide for DroidPad setup |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@copilot lets change the droidpad_integration.md to focus on how to implement the app and remove info about changes from the previous versions |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| leftTrackSpeed = constrain(leftTrackSpeed, -1.0, 1.0); | ||
| rightTrackSpeed = constrain(rightTrackSpeed, -1.0, 1.0); |
There was a problem hiding this comment.
The constrain() function expects integer parameters but is being passed float values. Use fminf() and fmaxf() functions or cast the result to ensure proper float constraint handling.
|
@copilot The constrain() function expects integer parameters but is being passed float values. Use fminf() and fmaxf() functions or cast the result to ensure proper float constraint handling. |
|
@copilot on lines 205 and 206 The constrain() function expects integer parameters but is being passed float values. Use fminf() and fmaxf() functions or cast the result to ensure proper float constraint handling. |
Overview
This PR addresses issue #14 by integrating native support for DroidPad and similar joystick interfaces that output values in the range of -1.0 to 1.0 (float) instead of the previous -100 to 100 (integer) range.
Problem
DroidPad (https://github.com/UmerCodez/DroidPad) outputs joystick values from 1.0 to -1.0, which is incompatible with the existing LifeTrac v25 control system that expected integer values from -100 to 100. This required changes across the ESP32 remote control, Arduino Opta controller, and ROS2 bridge to make all components natively interoperable.
Solution
Converted the entire control system to use floating-point values in the range -1.0 to 1.0 throughout the stack:
ESP32 Remote Control
ControlDatastruct to usefloatinstead ofint(joystick_value - 511.5) / 511.5to map 0-1023 ADC range to -1.0 to 1.010to0.1(maintaining 10% threshold)Arduino Opta Controller
JoystickDatastruct to usefloatvaluesDEADZONEconstant from10to0.14 + (int)(maxInput * 16.0)to maintain proper 4-20mA output rangecontrolTrack()andcontrolValve()to accept float parametersROS2 Bridge
ControlCommand.msgfields fromint32tofloat32Test Scripts
mqtt_test.pywith float values in demo sequences and interactive modeKey Technical Details
Value Conversion:
Flow Control Mapping (unchanged behavior):
MQTT Message Format:
{ "left_x": 0.0, // -1.0 to 1.0 (left/right turn) "left_y": 0.5, // -1.0 to 1.0 (forward/backward) "right_x": 0.0, // -1.0 to 1.0 (bucket control) "right_y": 0.7, // -1.0 to 1.0 (arms control) "timestamp": 1234567890 }Documentation
Added comprehensive
DROIDPAD_INTEGRATION.mdguide covering:Safety & Compatibility
✅ All safety features preserved:
✅ Functional equivalence maintained:
✅ Native DroidPad compatibility:
Testing
Verified mathematical correctness of conversion:
Flow control mapping verified:
Migration
Existing integrations need minimal changes:
Fixes #14
Co-authored-by: dorkmo 1923070+dorkmo@users.noreply.github.com
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.