Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

drivers_ard_asserv

furmi edited this page Feb 17, 2018 · 3 revisions

Description

This package is the driver interface between the ROS system and the controller board.

Authors and versions

  • v1.0 (A17) : @tfuhrman
    • First version of the driver with the controller board based on Arduino
    • Simulation of the robot displacement

Configuration

For now there is no configuration file to use the driver.

Communication

The communication is divided in two sections : the first one is for the communication with the ROS system and the second one for the communication with the controller board.

ROS system

Servers

Server name Type Function
/drivers/ard_asserv/goto_action Action Ask the robot to move. See goto_action below the table.
/drivers/ard_asserv/goto Service Ask the robot to move. Use action goto_action instead.
/drivers/ard_asserv/pwm Service Ask the robot to move, using PWM command.
/drivers/ard_asserv/speed Service Ask the robot to move, using speed command.
/drivers/ard_asserv/set_pos Service Set the position of the robot. This will over-right the current position of the robot in the control board.
/drivers/ard_asserv/emergency_stop Service Set the emergency flag, if true, the robot will stop immediately. If false, the robot will move again (if emergency_stop previously set).
/drivers/ard_asserv/parameters Service Change robot parameters. See *parameters below the table.
/drivers/ard_asserv/management Service Management robot goals stack. See management below the table.
/drivers/ard_asserv/pose2d Topic Robot pose2d (x, y) in meters and angle in radians, computed by the control board, using odometry.
/drivers/ard_asserv/speed Topic Robot speed (linear, pwm_speed and wheel_speed for each side), computed by the control board, using odometry.

goto_action

Mode parameter

  • 0 : GOTO, ask the robot to go to a x,y position (in meters)
  • 1 : GOTOA, ask the robot to go to a x,y position with an angle (in meters and radians)
  • 2 : ROT, ask the robot to go to and angle position, using modulo (in radians)
  • 3 : ROTNOMODULO, ask the robot to go to and angle position, not using modulo. This is used to ask the robot to turn multiple times, which is useful for odometry setting (in radians)

This node will send a goal reached when the robot is arrived to the correct position. Beware this node checks the robot position when arrived, is the robot is not at the correct position, the result of the goal result will be false.

You can check ROS actionlib for more details of the action management.

parameters

Mode parameter

  • 0 : SPDMAX, change the maximal speed of the robot and the speed_ratio (used for robot rotation)
    • Use the spd and spd_ratio parameter
  • 1 : ACCMAX, change the maximal acceleration of the robot
    • Use the acc parameter
  • 4 : PIDALL, change the PID coefficient for the left and right controllers
    • Use the p, i, d parameters

management

Mode parameter

  • 0 : KILLG, kill the current goal stored in the control board
  • 1 : CLEANG, clean the internal stack of the control board

Clients and subscriptions

Server name Type Function
/drivers/port_finder/get_port Service Get the Arduino port to use for serial communication. If the port does not exists the node is launched as simulator node.

Controller board

For now we use Arduino boards as controller board (Mega for the big robot and Nano for the small robot). The link between the controller board and the computation board is an USB serial link. That's why we had developed our own protocol to share information on the serial connexion.

For more details, you should check the arduino asserv page. //TODO create the arduino_asserv page

Using the package

Once the node is launched (with a controller board or in simulation mode) you can interact with it using :

  • ROS command line tools (rostopic, rosservice)
  • The webclient

To make the robot move you have to publish on the goto_action/goal topic or to use the goto service. You can check that the robot is really moving subscribing on the pose2d topic or checking the webclient.

If you want a rviz visualization you have to launch the localizer.

Running the package

The ard_asserv node can use serial communication to deal with the real control board or it can also launch as simulation mode. In order to determine the serial port where the controller board is, this package uses the port_finder package. If the port_finder package is not launched nor the controller board is not found, the simulation mode will be launched.

rosrun drivers_port_finder port_finder_node.py
rosrun drivers_ard_asserv ard_asserv_node.py

How it works

Files explanation

The list of files and the corresponding goal of them

  • ard_asserv_node : main file of this package, this is the ROS entry point. This file will create all topics and services and add the corresponding callbacks. This file manages the real or simulation mode, depending on the return of the port_finde get_port service.
  • asserv_abstract : abstract class used as the common interface for the real and simulation mode.
  • asserv_real : real asserv component, this file is used as an interface with the serial controller board. It's in this file that the commands are sent over the serial link.
  • asserv_simu : simulation asserv component, this file implements mathematic formula to make the robot move.
  • protocol_parser : function to parse the protocol.h file of the Arduino code of the controller board. This is useful because it make the package code proper, using the same names and conventions as in the controller board code.

//TODO add more explanation of the real asserv management (serial send and receive, position check) and on the simu asserv (how the robot position is computed)