UbiquityRobotics / ubiquity_motor

Package that provides a ROS interface for the motors in UbiquityRobotics robots
BSD 3-Clause "New" or "Revised" License
24 stars 23 forks source link

Clean up general parameter settings in robot.yaml and base.yaml #114

Closed mjstn closed 2 years ago

mjstn commented 3 years ago

We need to finalize changes set in motion over a year ago where we want to avoid use of apt upgrade from wiping out many customer specific settings made in the base.yaml file which can be updated on the apt upgrade.

The goals of this issue are two fold: 1) Document and understand parameter setup as used in shipping Magni images from mid 2020 2) Document and understand how we plan to have many parameters in robot.yaml 3) After a review by product experts of above points we decide our timeline to get all this stuff merged OR modified as required

History: We decided to move many motor controller and other key operating mode parameters from base.yaml to robot.yaml. A lot of work was done to do this by Rohan but the issue has been only creaping along and needs closure so that it will finally be safe to use magni_robot repository along with ubiquity_motor and our main codeline will then be more supportable again.

This issue spans the magni_robot and ubiquity_motor repositories in that the parameters of interest are mostly used in ubiquity_motor but the mechanisms to manage them are mostly in magni_robot launch related files for magni-base service.

How to proceed is first to generate document to explain this mess: Step one of this task will be to form a spreadsheet that shows names of each parameter and which will move to robot.yaml.

Key File Locations to help focus on the task this will be important to inspect and modify:

A line for each parameter we pull in from any .yaml file will be in a spreadsheet.

Then as notes in this spreadsheet (so we keep this all together) we want to explain the plan for what is in magni_robot repository today for launch files that will use robot.yaml much more for more ubiquity_motor things like PID, wheel characteristics and so on.

We want to document which parameters override others to explain these possibilities and more:

JanJericevic commented 3 years ago

(Moved correspondence from Slack for history)

This is the working document describing my work so far, made observations and questions I have. At the end, it describes the next assignment I will work on within the project. I will update this file as I finish individual assignments.

Feedback from @mjstn:

Your specific questions:

Not in any particular order but here is feedback:

mjstn commented 3 years ago

The specific goal here is to move the following parameters so they are in robot.yaml and do not come from base.yaml. The parameters below will exist in robot.yaml and will no longer be present in base.yaml

This might require changes to launch_core.py or just verification that is is working and getting parameters from robot.yaml

You need to understand how the system starts and it is complicated. Here are some basic notes of mine:

So core.launch must get the parameters below from robot.yaml and they will no longer be in base.yaml

serial_port: "/dev/ttyAMA0" pid_proportional: 5000 pid_integral: 2 pid_derivative: -100 pid_denominator: 1000 pid_moving_buffer_size: 50 pid_velocity: 0

Wheel separation and radius multipliers

wheel_separation_multiplier: 1.0 # default: 1.0 wheel_radius_multiplier : 1.0 # default: 1.0

Velocity and acceleration limits

Whenever a min* is unspecified, default to -max*

linear: x: has_velocity_limits : false max_velocity : 1.0 # m/s has_acceleration_limits: true max_acceleration : 0.5 # m/s^2 angular: z: has_velocity_limits : false max_velocity : 2.0 # rad/s has_acceleration_limits: true max_acceleration : 5.0 # rad/s^2 (edited)

Also in robot.yaml since it is related to these parameters we want to add OLED display enabled here

oled_display: controller : SH1106

mjstn commented 3 years ago

I will now explain roughly how these parameters get setup: (all in ubiquity_motor repository)

There are MANY parameters that do not show up at all that the motor node supports so they are all defaulted.
For the parameters we do pull in from the base.yaml and robot.yaml files those get passed in as ROS parameters as the motor node is launched in core.launch and then the motor node uses passed in params instead of defaults.

JanezCim commented 3 years ago

Please be advised that robot.yaml is not static - we are adding parameters in other projects (like extra parameter for lidar location and parameter weather or not the imu fusion is enabled). So before changing things here - which is prone to break a lot of stuff - @JanJericevic i suggest we have a call or something to talk about how those new parameters are usually added to projets that require custom setups.

JanJericevic commented 3 years ago

I created a branch in magni_robot repo. All of the changes so far can be viewed there.

rohbotics commented 3 years ago

from Slack

From @JanJericevic today: I'm curious why the robot.yaml file and its parameters are imported this way. Is there a specific reason why the parameters are imported using the py script and not by the tag in a launch file (as is base.yaml)? I'm asking because of the talk that we had the other day @mjstn. If the robot.yaml file could be included in such a way it would, I think, simplify things in regards to importing additional user-made parameters. Right now, if the user wants to add a parameter to robot.yaml, he also has to change launch_core.py so that it passes the parameter on to core.launch and then change core.launch as well so that it sets the parameter.

Here are the reasons it isn't a rosparam file:

If we are really trying to clean this up, it might make more sense for launch_core.py to generate the roslaunch XML based on the parameters. That might reduce the number of places we have to touch to add a new parameter. It would also allow for switching between different nodes at launch easier, for things like picking which lidar we have etc.

Also I would still keep the internal base.yaml for non-user editable "parameters".

JanJericevic commented 3 years ago

The incorporation of base.yaml file was left as is. My question came from talking to @mjstn how the robot.yaml file could eventually include many parameters (ours and user-added), because of which the launch_core.py and core.launch files could become overcluttered. Right now the only thing we did was move some of the parameters to robot.yaml and change the launch_core.py and core.launch so that they fit the moved parameters. The only thing that changed from a functionality perspective was the checking function in launch_core.py that checks if all the "default parameters" are included in robot.yaml.

So how do we proceed? Should I move to exploring the idea of generating the XML?

rohbotics commented 3 years ago

@JanJericevic I think for the purposes of this issue, the XML generation is way out of scope. I have created a new one https://github.com/UbiquityRobotics/magni_robot/issues/159

This issue should be closed as soon as the simple cleanup changes you have done are merged in.

JanJericevic commented 3 years ago

Ok I understand, thank you.