This code is referred and used for Leptrino 6-DoF Force Torque Sensor.
Some features are referred to hiveground.
A ROS 2 repository that interfaces with 6-DoF Leptrino Force Sensor. The offset of force sensor has been calculated to get actual force measurements. Enhanced with automatic recalibration capabilities for improved long-term accuracy.
- Real-time force/torque data - 6-DoF measurements at 1kHz
- Automatic calibration - Removes sensor drift and offset errors
- Multiple calibration methods - Service calls, topic triggers, or time-based
- Calibration monitoring - Real-time status feedback
- Thread-safe operation - Safe concurrent access to calibration functions
- Configurable parameters - Flexible setup for different applications
cd /path/to/ros2-workspace/src
git clone https://github.com/labiybafakh/leptrino_force_torque_sensorcd /path/to/ros2-workspace/
colcon build --symlink-install --packages-select leptrino_force_torque_sensor --cmake-args -DCMAKE_BUILD_TYPE=Releasesource install/local_setup.bashsudo chmod 666 /dev/ttyACM0ros2 launch leptrino_force_torque_sensor leptrino.launch.py # Launch with different serial port
ros2 launch leptrino_force_torque_sensor leptrino.launch.py com_port:=/dev/ttyUSB0
# Launch with auto-recalibration enabled
ros2 launch leptrino_force_torque_sensor leptrino.launch.py \
auto_recalibration_enabled:=true \
auto_recalibration_interval_minutes:=15.0
# Launch with custom calibration sample count
ros2 launch leptrino_force_torque_sensor leptrino.launch.py \
calibration_samples:=200Force-torque sensors experience drift over time due to:
- Temperature changes - Affects strain gauge readings
- Mechanical stress - Mounting forces and vibrations
- Electronic drift - Amplifier offset changes
- Gravitational effects - Sensor orientation dependency
- Component aging - Long-term material changes
Calibration removes these systematic errors by measuring the sensor's zero-point when no external forces are applied.
When to use: For on-demand, precise calibration.
# Trigger calibration
ros2 service call /leptrino/recalibrate std_srvs/srv/Trigger
# Expected response:
# success: True
# message: "Recalibration completed successfully"When to use: For integration with external systems or automated workflows.
# Trigger calibration via topic
ros2 topic pub /leptrino/recalibrate_trigger std_msgs/msg/Empty "{}" --onceWhen to use: For continuous operation without manual intervention.
Configure in config/params.yaml:
leptrino_sensor:
ros__parameters:
auto_recalibration_enabled: true
auto_recalibration_interval_minutes: 30.0 # Every 30 minutes
calibration_samples: 100Or via launch parameters:
ros2 launch leptrino_force_torque_sensor leptrino.launch.py \
auto_recalibration_enabled:=true \
auto_recalibration_interval_minutes:=20.0- Ensure no external forces - Remove all loads from the sensor
- Stable mounting - Minimize vibrations and movement
- Temperature stability - Wait for thermal equilibrium (~5 minutes)
- Proper orientation - Sensor should be in operational position
# 1. Launch the sensor
ros2 launch leptrino_force_torque_sensor leptrino.launch.py
# 2. Wait for sensor initialization (check logs for "Data acquisition is started")
# 3. Remove all external forces from the sensor
# 4. Trigger calibration
ros2 service call /leptrino/recalibrate std_srvs/srv/Trigger
# 5. Wait for completion (typically 100ms for 100 samples)
# 6. Verify calibration success in logs# Monitor calibration status in real-time
ros2 topic echo /leptrino/calibration_status
# While calibrating: data: true
# When complete: data: false| Application | Frequency | Trigger |
|---|---|---|
| Research/Lab | Before each experiment | Manual service call |
| Industrial | Every 15-30 minutes | Automatic timer |
| Robotics | Before precision tasks | Programmatic service call |
| Continuous | Temperature change >5°C | Manual or automatic |
| Parameter | Type | Default | Description |
|---|---|---|---|
com_port |
string | /dev/ttyACM0 |
Serial port device |
auto_recalibration_enabled |
bool | false |
Enable automatic recalibration |
auto_recalibration_interval_minutes |
double | 30.0 |
Minutes between auto-calibrations |
calibration_samples |
int | 100 |
Number of samples for calibration |
leptrino_sensor:
ros__parameters:
com_port: "/dev/ttyACM0"
auto_recalibration_enabled: true
auto_recalibration_interval_minutes: 15.0
calibration_samples: 200ros2 launch leptrino_force_torque_sensor leptrino.launch.py \
com_port:=/dev/ttyACM0 \
auto_recalibration_enabled:=true \
auto_recalibration_interval_minutes:=10.0 \
calibration_samples:=150| Topic | Message Type | Description |
|---|---|---|
/leptrino |
geometry_msgs/WrenchStamped |
Force/torque measurements |
/leptrino/calibration_status |
std_msgs/Bool |
Calibration status (true = calibrating) |
| Topic | Message Type | Description |
|---|---|---|
/leptrino/recalibrate_trigger |
std_msgs/Empty |
Trigger calibration via topic |
| Service | Service Type | Description |
|---|---|---|
/leptrino/recalibrate |
std_srvs/Trigger |
Manual calibration trigger |
# Monitor force/torque data
ros2 topic echo /leptrino
# Monitor calibration status
ros2 topic echo /leptrino/calibration_status
# Trigger calibration via service
ros2 service call /leptrino/recalibrate std_srvs/srv/Trigger
# Trigger calibration via topic
ros2 topic pub /leptrino/recalibrate_trigger std_msgs/msg/Empty "{}" --once
# List all leptrino topics
ros2 topic list | grep leptrino
# List all leptrino services
ros2 service list | grep leptrino