Example Rover - Software¶
Link to module repo: Example Rover - Software
Overview¶
As described in Get An Overview of EEROS the example rover comprises of a control system, a safety system and a sequencer. Most probably you want to make your EEROS control a ROS node. You can easily control the robot with ROS messages and gather valuable information by publishing ROS messages with status information about your rover. Read more under ROS.
Control System¶
The example rover has a very basic control system as shown below
The two OST23 wheels are connected through a CAN bus. The local values of the drive velocities and turn angles have to be passed from the receive to the send block as the inverse kinematic inside this block must be aware of the exact position of the two wheels in order to react to various setpoints.
Safety System¶
The safety system has several levels to ensure a safe and stable operation. The remote control allows for enabling the drives and running them as well as disabling them and going into an idle state.
In all of these states the output of the safety relay of the rover is checked. Whenever this output indicates that a safety relevant action has occurred the safety system switches to an emergency level. The emergency state can be left as soon as the safety relay signals that the system is back to normal.
The communication on the CAN bus can fail. This could happen at the very beginning if the CAN bus is not activated or it could happen during normal operation. In such a case the CAN driver throws an exception which must be caught. The safety system has to go to its off state which makes sure that the safety relay switches of the power of the drives and terminates the application immediately.
You can always stop the program when pressing CTRL-C. The drives will be disabled and the software stops gracefully.
Sequencer¶
The main sequence is responsible to start subsequences when appropriate, e.g. for initializing the drives, or enabling or disabling them.
Configuration¶
Every rover needs to be configured. While each component, such as the wheels or the remote control, has its own configuration part, the rover itself needs some global specifications. It must bring the configurations of the individual parts together. This is done in include/RoverConfig.hpp with
class RoverConfig {
public:
bool readJSON(std::string path) {
std::string error;
auto json =
ucl::Ucl::parse_from_file_strategy(path, UCL_DUPLICATE_ERROR, error);
if (!json) return false;
eeros::tf::TF_Tree::instance().initJSON(json);
for (auto& wheel : json["driveModules"]) wheels.emplace_back(wheel);
rc = json["remoteControl"];
general = json["rover"];
return true;
}
wheel::Config::WheelConfig wheels;
rc::Config rc;
ucl::Ucl general;
};
For testing purposes you can print your actual configuration with
auto config = config::RoverConfig{};
config.readJSON(argv[1]);
config.rc.printValues();
for (auto& w : config.wheels) w.printValues();
config.printValues();
A rover imports the configuration of each wheel. It then overrides these settings (with the help of the file config/overrides.json). The CAN identifier of both drives of each wheel must be specified. And the position of the wheel relatively to the central point of the rover must also be set.
Overriding the Configuration of Modules¶
The configuration of the single modules might be exactly what you need. If not, you can easily override some of this settings or all of them. To state an example: the configuration for the remote control is quite large due to the many signals available. Among the settings you will find the interface settings for the serial port of the SBUS in the file config/config.json.
Pretty sure, this setting does not apply to your actual setting. Simply override this setting in config/overrides.json of your rover with
ROS¶
It is very convenient to use ROS either to navigate or for logging purposes, see ROS.
Global Positioning System¶
We use a RTK receiver from ardusimple with centimeter resolution when using NTRIP server see GNSS.
TF Tree¶
The tf tree with the two wheels and two antennas used by GNSS will look like
flowchart TD
A([Wheel Module <br> Reference Position 0]) --> R[robot]
B([Wheel Module <br> Reference Position 1]) --> R
C([Wheel <br> Axis Position 0]) --> A
D([Wheel <br> Axis Position 1]) --> B
R --> E([GNSS Global Position])
F([GNSS Antenna Reference]) --> R
F([GNSS Antenna Reference]) --> E
G([GNSS Antenna Heading]) --> R
Scripts¶
To be done