-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mecanum rover: add dedicated module for mecanum rovers (#23708)
- Loading branch information
1 parent
43509b5
commit 0e65679
Showing
33 changed files
with
1,677 additions
and
5 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
ROMFS/px4fmu_common/init.d-posix/airframes/4015_gz_r1_rover_mecanum
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
# @name Aion Robotics R1 Rover | ||
# @type Rover | ||
# @class Rover | ||
|
||
. ${R}etc/init.d/rc.rover_mecanum_defaults | ||
|
||
PX4_SIMULATOR=${PX4_SIMULATOR:=gz} | ||
PX4_GZ_WORLD=${PX4_GZ_WORLD:=rover} | ||
PX4_SIM_MODEL=${PX4_SIM_MODEL:=r1_rover_mecanum} | ||
|
||
param set-default SIM_GZ_EN 1 # Gazebo bridge | ||
|
||
# Rover parameters | ||
param set-default RM_WHEEL_TRACK 0.3 | ||
param set-default RM_MAN_YAW_SCALE 0.1 | ||
param set-default RM_YAW_RATE_I 0 | ||
param set-default RM_YAW_RATE_P 0.01 | ||
param set-default RM_MAX_ACCEL 3 | ||
param set-default RM_MAX_JERK 5 | ||
param set-default RM_MAX_SPEED 4 | ||
param set-default RM_MAX_THR_SPD 7 | ||
param set-default RM_MAX_THR_YAW_R 7.5 | ||
param set-default RM_YAW_P 5 | ||
param set-default RM_YAW_I 0.1 | ||
param set-default RM_MAX_YAW_RATE 180 | ||
param set-default RM_MISS_SPD_DEF 3 | ||
param set-default RM_MISS_VEL_GAIN 1 | ||
param set-default RM_SPEED_I 0.01 | ||
param set-default RM_SPEED_P 0.1 | ||
|
||
# Pure pursuit parameters | ||
param set-default PP_LOOKAHD_MAX 10 | ||
param set-default PP_LOOKAHD_MIN 1 | ||
param set-default PP_LOOKAHD_GAIN 0.5 | ||
|
||
# Simulated sensors | ||
param set-default SENS_EN_GPSSIM 1 | ||
param set-default SENS_EN_BAROSIM 0 | ||
param set-default SENS_EN_MAGSIM 1 | ||
param set-default SENS_EN_ARSPDSIM 0 | ||
|
||
# Actuator mapping | ||
param set-default SIM_GZ_WH_FUNC1 102 # right wheel front | ||
param set-default SIM_GZ_WH_MIN1 0 | ||
param set-default SIM_GZ_WH_MAX1 200 | ||
param set-default SIM_GZ_WH_DIS1 100 | ||
|
||
param set-default SIM_GZ_WH_FUNC2 101 # left wheel front | ||
param set-default SIM_GZ_WH_MIN2 0 | ||
param set-default SIM_GZ_WH_MAX2 200 | ||
param set-default SIM_GZ_WH_DIS2 100 | ||
|
||
param set-default SIM_GZ_WH_FUNC3 104 # right wheel back | ||
param set-default SIM_GZ_WH_MIN3 0 | ||
param set-default SIM_GZ_WH_MAX3 200 | ||
param set-default SIM_GZ_WH_DIS3 100 | ||
|
||
param set-default SIM_GZ_WH_FUNC4 103 # left wheel back | ||
param set-default SIM_GZ_WH_MIN4 0 | ||
param set-default SIM_GZ_WH_MAX4 200 | ||
param set-default SIM_GZ_WH_DIS4 100 | ||
|
||
param set-default SIM_GZ_WH_REV 10 |
This file contains 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
This file contains 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
12 changes: 12 additions & 0 deletions
12
ROMFS/px4fmu_common/init.d/airframes/52000_generic_rover_mecanum
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
# | ||
# @name Generic Rover Mecanum | ||
# | ||
# @type Rover | ||
# @class Rover | ||
# | ||
# @board px4_fmu-v2 exclude | ||
# @board bitcraze_crazyflie exclude | ||
# | ||
|
||
. ${R}etc/init.d/rc.rover_mecanum_defaults |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# Standard apps for a mecanum drive rover. | ||
|
||
# Start rover mecanum drive controller. | ||
rover_mecanum start | ||
|
||
# Start Land Detector. | ||
land_detector start rover |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# Mecanum rover parameters. | ||
|
||
set VEHICLE_TYPE rover_mecanum | ||
param set-default MAV_TYPE 10 # MAV_TYPE_GROUND_ROVER | ||
param set-default CA_AIRFRAME 13 # Rover (Mecanum) | ||
param set-default CA_R_REV 15 # Right and left motors reversible | ||
param set-default EKF2_MAG_TYPE 1 # make sure magnetometer is fused even when not flying | ||
param set-default NAV_ACC_RAD 0.5 # Waypoint acceptance radius | ||
param set-default EKF2_GBIAS_INIT 0.01 | ||
param set-default EKF2_ANGERR_INIT 0.01 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
uint64 timestamp # time since system start (microseconds) | ||
|
||
float32 lookahead_distance # [m] Lookahead distance of pure the pursuit controller | ||
float32 heading_error # [rad] Heading error of the pure pursuit controller | ||
float32 desired_speed # [m/s] Desired velocity magnitude (speed) | ||
|
||
# TOPICS rover_mecanum_guidance_status |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
uint64 timestamp # time since system start (microseconds) | ||
|
||
float32 forward_speed_setpoint # [m/s] Desired forward speed | ||
float32 forward_speed_setpoint_normalized # [-1, 1] Desired normalized forward speed | ||
float32 lateral_speed_setpoint # [m/s] Desired lateral speed | ||
float32 lateral_speed_setpoint_normalized # [-1, 1] Desired normalized lateral speed | ||
float32 yaw_rate_setpoint # [rad/s] Desired yaw rate | ||
float32 yaw_rate_setpoint_normalized # [-1, 1] Desired normalized yaw rate | ||
float32 yaw_setpoint # [rad] Desired yaw (heading) | ||
|
||
# TOPICS rover_mecanum_setpoint |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
uint64 timestamp # time since system start (microseconds) | ||
|
||
float32 measured_forward_speed # [m/s] Measured speed in body x direction. Positiv: forwards, Negativ: backwards | ||
float32 measured_lateral_speed # [m/s] Measured speed in body y direction. Positiv: right, Negativ: left | ||
float32 adjusted_yaw_rate_setpoint # [rad/s] Yaw rate setpoint output of the closed loop yaw controller | ||
float32 measured_yaw_rate # [rad/s] Measured yaw rate | ||
float32 measured_yaw # [rad] Measured yaw | ||
float32 pid_yaw_rate_integral # Integral of the PID for the closed loop yaw rate controller | ||
float32 pid_yaw_integral # Integral of the PID for the closed loop yaw controller | ||
float32 pid_forward_throttle_integral # Integral of the PID for the closed loop forward speed controller | ||
float32 pid_lateral_throttle_integral # Integral of the PID for the closed loop lateral speed controller | ||
|
||
# TOPICS rover_mecanum_status |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
############################################################################ | ||
# | ||
# Copyright (c) 2024 PX4 Development Team. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# 3. Neither the name PX4 nor the names of its contributors may be | ||
# used to endorse or promote products derived from this software | ||
# without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
############################################################################ | ||
|
||
add_subdirectory(RoverMecanumGuidance) | ||
add_subdirectory(RoverMecanumControl) | ||
|
||
px4_add_module( | ||
MODULE modules__rover_mecanum | ||
MAIN rover_mecanum | ||
SRCS | ||
RoverMecanum.cpp | ||
RoverMecanum.hpp | ||
DEPENDS | ||
RoverMecanumGuidance | ||
RoverMecanumControl | ||
px4_work_queue | ||
pure_pursuit | ||
MODULE_CONFIG | ||
module.yaml | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
menuconfig MODULES_ROVER_MECANUM | ||
bool "rover_mecanum" | ||
default n | ||
depends on MODULES_CONTROL_ALLOCATOR | ||
---help--- | ||
Enable support for control of mecanum rovers |
Oops, something went wrong.