Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minimum velocity parameters to launch #221

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion magni_bringup/config/default_robot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Default Robot Configuration

# WARNING: Changing the content of this folder effects the working of magni_bringup/scripts/launch_core.py !!!
# Make sure you understand what you're doing before changing anything in here.
# Make sure you understand what you're doing before changing anything in here.


# ============================================= USER CHANGEABLE PARAMETERS =================================================
Expand Down Expand Up @@ -79,11 +79,15 @@ ubiquity_velocity_controller:
x:
has_velocity_limits : true
max_velocity : 1.0 # m/s
min_velocity : -1.0 # m/s
has_acceleration_limits: true
max_acceleration : 1.1 # m/s^2
min_acceleration : -1.1 # m/s^2
angular:
z:
has_velocity_limits : true
max_velocity : 2.0 # rad/s
min_velocity : -2.0 # rad/s
has_acceleration_limits: true
max_acceleration : 5.0 # rad/s^2
min_acceleration : -5.0 # rad/s^2
6 changes: 5 additions & 1 deletion magni_bringup/launch/core_launch.em
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<arg name="sonars_installed" default="@(sonars_installed)"/>
<arg name="oled_display" default="@(oled_display)"/>
<arg name="controller_board_version" default="@(controller_board_version)"/>

<include file="$(find magni_description)/launch/description.launch">
<arg name="camera_extrinsics_file" value="@(camera_extrinsics_file)"/>
<arg name="lidar_extrinsics_file" value="@(lidar_extrinsics_file)"/>
Expand Down Expand Up @@ -67,16 +67,20 @@
<param name="/ubiquity_velocity_controller/wheel_radius" value="@(wheel_radius)"/>
<param name="/ubiquity_velocity_controller/linear/x/has_velocity_limits" value="@(lin_has_velocity_limits)"/>
<param name="/ubiquity_velocity_controller/linear/x/max_velocity" value="@(lin_max_velocity)"/>
<param name="/ubiquity_velocity_controller/linear/x/min_velocity" value="@(lin_min_velocity)"/>
<param name="/ubiquity_velocity_controller/linear/x/has_acceleration_limits" value="@(lin_has_acceleration_limits)"/>
<param name="/ubiquity_velocity_controller/linear/x/max_acceleration" value="@(lin_max_acceleration)"/>
<param name="/ubiquity_velocity_controller/linear/x/min_acceleration" value="@(lin_min_acceleration)"/>

<rosparam param="/ubiquity_velocity_controller/pose_covariance_diagonal">@(pose_covariance_diagonal)</rosparam>
<rosparam param="/ubiquity_velocity_controller/twist_covariance_diagonal">@(twist_covariance_diagonal)</rosparam>

<param name="/ubiquity_velocity_controller/angular/z/has_velocity_limits" value="@(ang_has_velocity_limits)"/>
<param name="/ubiquity_velocity_controller/angular/z/max_velocity" value="@(ang_max_velocity)"/>
<param name="/ubiquity_velocity_controller/angular/z/min_velocity" value="@(ang_min_velocity)"/>
<param name="/ubiquity_velocity_controller/angular/z/has_acceleration_limits" value="@(ang_has_acceleration_limits)"/>
<param name="/ubiquity_velocity_controller/angular/z/max_acceleration" value="@(ang_max_acceleration)"/>
<param name="/ubiquity_velocity_controller/angular/z/min_acceleration" value="@(ang_min_acceleration)"/>

<!-- Launch the roscontrol controllers needed -->
<node name="controller_spawner" pkg="controller_manager" type="spawner"
Expand Down
20 changes: 12 additions & 8 deletions magni_bringup/scripts/launch_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_config_replace_missing(conf_path, default_conf):
try:
y_conf = yaml.safe_load(conf_file)
except Exception as e:
print(clr.ERROR +
print(clr.ERROR +
+ "Error reading yaml file from "
+ conf_path
+ ", using default configuration"
Expand All @@ -96,12 +96,12 @@ def get_config_replace_missing(conf_path, default_conf):
# if any key missing in y_conf replace it individually from default_conf
dict_replace_missing(y_conf, default_conf)

# print(y_conf)
# print(y_conf)
return y_conf
except IOError:
print(clr.WARN
print(clr.WARN
+ "WARN "
+ conf_path
+ conf_path
+ " doesn't exist, using default configuration"
+ clr.ENDC)
return default_conf
Expand Down Expand Up @@ -135,7 +135,7 @@ def create_core_launch_file(
mot_cont = conf["ubiquity_motor"]
vel_cont = conf["ubiquity_velocity_controller"]
joint_pub = conf["ubiquity_joint_publisher"]

try:
with open(em_path) as em_launch_file:
em_launch = em_launch_file.read()
Expand Down Expand Up @@ -167,7 +167,7 @@ def create_core_launch_file(
"fw_max_speed_rev": str(mot_cont["fw_max_speed_rev"]),
"pid_moving_buffer_size": str(mot_cont["pid_moving_buffer_size"]),
"pid_velocity": str(mot_cont["pid_velocity"]),

"joint_controller_type": str(joint_pub["type"]),
"joint_controller_publish_rate": str(joint_pub["publish_rate"]),

Expand All @@ -187,13 +187,17 @@ def create_core_launch_file(
"wheel_radius_multiplier": str(vel_cont["wheel_radius_multiplier"]),
"lin_has_velocity_limits": str(vel_cont["linear"]["x"]["has_velocity_limits"]),
"lin_max_velocity": str(vel_cont["linear"]["x"]["max_velocity"]),
"lin_min_velocity": str(vel_cont["linear"]["x"]["min_velocity"]),
"lin_has_acceleration_limits": str(vel_cont["linear"]["x"]["has_acceleration_limits"]),
"lin_max_acceleration": str(vel_cont["linear"]["x"]["max_acceleration"]),
"lin_min_acceleration": str(vel_cont["linear"]["x"]["min_acceleration"]),

"ang_has_velocity_limits": str(vel_cont["angular"]["z"]["has_velocity_limits"]),
"ang_max_velocity": str(vel_cont["angular"]["z"]["max_velocity"]),
"ang_min_velocity": str(vel_cont["angular"]["z"]["min_velocity"]),
"ang_has_acceleration_limits": str(vel_cont["angular"]["z"]["has_acceleration_limits"]),
"ang_max_acceleration": str(vel_cont["angular"]["z"]["max_acceleration"]),
"ang_min_acceleration": str(vel_cont["angular"]["z"]["min_acceleration"]),
},
)
except FileNotFoundError:
Expand All @@ -211,7 +215,7 @@ def create_core_launch_file(


"""
If the first file exists, return it, otherwise return the second file.
If the first file exists, return it, otherwise return the second file.
If none of them exists returns empty string.

:param first_path: The path to the file you want to find
Expand Down Expand Up @@ -413,7 +417,7 @@ def main():
print(clr.OK
+ "Launch check OK"
+ clr.ENDC)


if __name__ == "__main__":
main()