This packages creates an orchestor for automatic charging to the docking station of Robotnik robots.
Important
It depends on charge_manager and robotnik_navigation_msgs.
ros2 launch robotnik_charge robotnik_charge_launch.py
ros2 actions send_goal /robot/charge robotnik_navigation_msgs/action/Charge "dock_frame='' robot_dock_frame='' dock_offset= retries= "
The charge action depends on 4 arguments:
- dock_frame: Frame reference to where the robot should dock, it's usually the docking station marker frame.
- robot_dock_frame: Base frame of the robot to align to dock_frame, it's usually the docking contact frame.
- dock_offset: The distance that the docking action should stop before the docking station.
- retries: The number of maximum retries that the charge action must do.
The charge process follows the next steps:
- If the robotnik_charge is in the correct state (not doing any other action)
- There is battery information
- The robot is not already charging
- The frame exists
- The dock and move actions are correct
If there is any issue with this, the action will be rejected.
- If the robot has safety laser, change to the mode during action**(Still pending to be implemented)**
- Send dock goal with offset.
- Once dock is compleated, send move goal.
- Once move is compleated, activate relay.
- Wait for charge detected.
- If not charging, move backwards and repeat.
- If all tries are compleated, wait forced to 10s.
- If not charging, move backwards and abort.
If during the process there is any failure, the action is aborted.
ros2 actions send_goal /robot/uncharge robotnik_navigation_msgs/action/Uncharge {}
The uncharge action doesn't need any argument.
The charge process follows the next steps:
- If the robotnik_charge is in the correct state (not doing any other action)
- There is battery information
- The robot is already charging
If there is any issue with this, the action will be rejected.
- Deactivate relay.
- If the robot has safety laser, change to the mode during action (Still pending to be implemented)
- Move backwards.
- Rotate.
- If the robot has safety laser, change to the mode after action (Still pending to be implemented)
If during the process there is any failure, the action is aborted.
There is a config file where the parameters are configured before launching the node.
These are the parameters:
-
rate:
- type: int
- default_value: 10
- read_only: true
- description: "Frequency to run the action. default: 10"
-
step_timeout:
- type: double
- default_value: 30.0
- read_only: true
- description: "Seconds of timeout that each step of the charging or uncharging method must last. default: 30.0"
-
charge_contact_distance_from_marker:
- type: double
- default_value: 0.14
- read_only: true
- description: "Distance from marker to charge contact in docking station. default: 0.14"
-
timeout_charging_detection:
- type: int
- default_value: 1
- read_only: true
- description: "Seconds to wait to detect charge. default: 1"
-
has_safety_lasers:
- type: bool
- default_value: false
- description: "If the robot has safety lasers, the safety mode must change. default: false"
-
laser_mode_during_action:
- type: string
- default_value: "charging_station"
- description: "Laser mode during the charge or uncharge action. default: charging_station"
-
laser_mode_after_action:
- type: string
- default_value: "standard"
- description: "Laser mode at the end of the uncharge action. default: standard"
-
step_back_distance:
- type: double
- default_value: 0.5
- description: "Distance to step back during uncharge. default: 0.5"
-
rotation:
- type: double
- default_value: 0.0
- description: "Rotation to apply after uncharge step back. default: 0.0"
-
dock.action_namespace:
- type: string
- default_value: "/smooth_drive/dock"
- description: "Name of dock action. default: /smooth_drive/dock"
-
dock.max_velocity.x:
- type: double
- default_value: 1.0
- description: "Maximum velocity in x axis for dock action. default: 1.0"
-
dock.max_velocity.y:
- type: double
- default_value: 0.0
- description: "Maximum velocity in y axis for dock action. default: 0.0"
-
dock.max_velocity.yaw:
- type: double
- default_value: 1.0
- description: "Maximum velocity in yaw for dock action. default: 1.0"
-
move.action_namespace:
- type: string
- default_value: "/move"
- description: "Name of move action. default: /move"
-
move.max_velocity.x:
- type: double
- default_value: 0.0
- description: "Maximum velocity in x axis for move action. default: 0.0"
-
move.max_velocity.y:
- type: double
- default_value: 0.0
- description: "Maximum velocity in y axis for move action. default: 0.0"
-
move.max_velocity.yaw:
- type: double
- default_value: 0.0
- description: "Maximum velocity in yaw for move action. default: 0.0"