Robobot base software installation

From Rsewiki

Back to Robobot B

Robobot base software

To make the initial copy from the repository (Linux)

cd
mkdir -p svn
cd svn
svn checkout svn://repos.gbar.dtu.dk/jcan/robobot

To update with a new version

cd
cd svn/robobot
svn update

The repository is open for reading at the above address if you want to see the source code on other platforms.

Compile base software

IP display

Go to svn/robobot/ip_disp, the app that handles the display of IP and listens to the start button.

cd ~/svn/robobot/ip_disp
mkdir build
cd build
cmake ..
make -j3

This will be started at reboot

Off service

Go to svn/robobot/off_by_mqtt, the app will handle the power off situation only.

cd ~/svn/robobot/off_by_mqtt
mkdir build
cd build
cmake ..
make -j3

This will be started at reboot

Teensy_interface

Go to ~/svn/robobot/teensy_interface. This app communicates with Teensy and translates to and from MQTT.

cd ~/svn/robobot/teensy_interface
mkdir build
cd build
cmake ..
make -j3

Configure

Python base code

The Python MQTT client needs to know the IP address of the MQTT server, i.e. the robot.

The default IP is 127.0.0.1, the robot's own IP address. This is fine when the code runs on the robot, but it needs to be changed when the code runs on another PC.

The service.setup() line determines the IP in the _ _ main _ _ function in the file mqtt-client.py. The IP to use is displayed on the robot.

if __name__ == "__main__":
   print("% Starting")
   service.setup(10.197.216.216)
   if service.connected:
     loop()
     service.terminate()
   print("% Main Terminated")

Teensy interface

The Teensy interface is configured using an initialization file robot.ini.

Copy the "factory" settings to the build directory:

cd ~/svn/robobot/teensy_interface
cp robot.ini build/

There are some common items in the file, like:

  • interval_pose_ms = 5 sets the interval between pose updates to 5 ms. A value of 0 means no data. An interval of 1 or 2 ms is possible but will load the interfaces and may cause unwanted data loss.
  • log_pose = true a logfile with timestamped will be created if such log_xxx' flags are true.
  • use = true if false, then this function is disabled.
  • Some items are not relevant for this robot type.
  • The [GPIO] function should NOT be enabled.

This file looks like this (SVN version 864 of 9 Jan 2025):

[service]
use_robot_hardware = true
logpath = log_%d/
; the '%d' will be replaced with date and timestamp (must end with a '/'). = 
max_logging_minutes = 1000
log_service = true

[mqtt]
broker = tcp://localhost:1883
context = drive
clientid = dot
function = drive/
system = robobot/
log = true
print = false
use = true

[teensy0]
use = true
type = robobot
idx = 124
; robot 'name' and 'idx' are read-only, use a command line option to change = 
name = Dot
device = /dev/ttyACM0
log = true
print = false
confirm_timeout = 0.04
encrev = true
hardware = 8

[robot0]
log = true
print = false
regbot_version = 696
shutdown_file = /home/local/shutdown.now
batteryusedwh = 301.963426
batterycalibrate = 1.0

[encoder0]
interval_pos_ms = 0
interval_vel_ms = 15
print = false
encoder_reversed = true
interval_pose_ms = 5
log_enc = true
log_pose = true

[imu1teensy0]
gyro_offset = 0 0 0
log = true
print_gyro = false
print_acc = false
interval_gyro_ms = 0
interval_acc_ms = 0

[imu2teensy0]
use = false
gyro_offset = 0 0 0
log = true
print_gyro = false
print_acc = false
interval_gyro_ms = 0
interval_acc_ms = 0

[servotn0]
interval_ms = 0
log = true
print = true

[motor_teensy_0]
m1kp = 7.0
m1lead = 0 1.0
m1taui = 0.05
m1feedforward = 0
m1maxmotv = 8.0
m1voffset = 0.0
m2kp = 7.0
m2lead = 0 1.0
m2taui = 0.05
m2feedforward = 0
m2maxmotv = 8.0
m2voffset = 0.0
log_voltage = true
m1log_pid = true
m2log_pid = true
m1print = false
m2print = false
interval_motv_ms = 25
interval_motpwm_ms = 0

[velocity0]
enctickperrev = 68
motorscale = 1 1
useteensyvel = true
log = true
print = false

[current_teensy_0]
log = true
print = false
interval_ms = 10

[distforce0]
interval_ird_ms = 0
log_dist = true
log_force = false
print = false
force = false

[gpio]
pins_out = 12=0 16=0
stop_on_stop = true
blink_period_ms = 600
log = true
print = false
use = false

[mixer]
use = true
log = true
print = false
driveleft = 0 0 -1
driveright = 0 1 -1
wheelbase = 0.22
motor_gear = 18
drive_gear = 1
wheel_radius = 0.09

[joy_logitech]
log = true
print = false
device = /dev/input/js0
device_type = Logitech Gamepad F710

[joy_use]
log = true
print = false
drive_control = true
vel_limit = -1.5
vel_axis = 4
turn_limit = 10.0
turn_axis = 3
button_fast = 5
slow_factor = 0.3
axis_servo = 1
servo = 1
servoScale = 10

[ini]
; set 'saveconfig' to 'false' to avoid autosave = 
saveconfig = true
version = 859 2025-01-07 08:37:26

[edge0]
log = true
print = false
interval_liv_ms = 0
interval_livn_ms = 10