Robobot base software installation: Difference between revisions

From Rsewiki
 
(11 intermediate revisions by the same user not shown)
Line 16: Line 16:
  svn update
  svn update


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


==Compile base software ==
==Compile base software ==
Line 25: Line 25:


  cd ~/svn/robobot/ip_disp
  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
  mkdir build
  cd build
  cd build
Line 43: Line 55:


== Configure ==
== 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''.
The Teensy interface is configured using an initialization file ''robot.ini''.
Line 51: Line 82:
  cp robot.ini build/
  cp robot.ini build/


This file looks like this (svn version 864 of 9 Jan 2025):
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]
  [service]
Line 59: Line 97:
  max_logging_minutes = 1000
  max_logging_minutes = 1000
  log_service = true
  log_service = true
  [mqtt]
  [mqtt]
  broker = tcp://localhost:1883
  broker = tcp://localhost:1883
Line 68: Line 107:
  print = false
  print = false
  use = true
  use = true
  [teensy0]
  [teensy0]
  use = true
  use = true
  type = robobot
  type = robobot
  idx = 124
  idx = 124
  ; robot 'name' and 'idx' are read-only, use command line option to change =  
  ; robot 'name' and 'idx' are read-only, use a command line option to change =  
  name = Dot
  name = Dot
  device = /dev/ttyACM0
  device = /dev/ttyACM0
Line 80: Line 120:
  encrev = true
  encrev = true
  hardware = 8
  hardware = 8
  [robot0]
  [robot0]
  log = true
  log = true
Line 85: Line 126:
  regbot_version = 696
  regbot_version = 696
  shutdown_file = /home/local/shutdown.now
  shutdown_file = /home/local/shutdown.now
  batteryusedwh = 242.503580
  batteryusedwh = 301.963426
  batterycalibrate = 1.0
  batterycalibrate = 1.0
  [encoder0]
  [encoder0]
  rate_pos_ms = 0
  interval_pos_ms = 0
  rate_vel_ms = 15
  interval_vel_ms = 15
  print = false
  print = false
  encoder_reversed = true
  encoder_reversed = true
  rate_pose_ms = 5
  interval_pose_ms = 5
  log_enc = true
  log_enc = true
  log_pose = true
  log_pose = true
  [imu1teensy0]
  [imu1teensy0]
  gyro_offset = 0 0 0
  gyro_offset = 0 0 0
Line 100: Line 143:
  print_gyro = false
  print_gyro = false
  print_acc = false
  print_acc = false
  rate_gyro_ms = 0
  interval_gyro_ms = 0
  rate_acc_ms = 0
  interval_acc_ms = 0
  [imu2teensy0]
  [imu2teensy0]
  use = false
  use = false
Line 108: Line 152:
  print_gyro = false
  print_gyro = false
  print_acc = false
  print_acc = false
  rate_gyro_ms = 0
  interval_gyro_ms = 0
  rate_acc_ms = 0
  interval_acc_ms = 0
  [servotn0]
  [servotn0]
  rate_ms = 0
  interval_ms = 0
  log = true
  log = true
  print = true
  print = true
  [motor_teensy_0]
  [motor_teensy_0]
  m1kp = 7.0
  m1kp = 7.0
Line 132: Line 178:
  m1print = false
  m1print = false
  m2print = false
  m2print = false
  rate_motv_ms = 25
  interval_motv_ms = 25
  rate_motpwm_ms = 0
  interval_motpwm_ms = 0
  [velocity0]
  [velocity0]
  enctickperrev = 68
  enctickperrev = 68
Line 140: Line 187:
  log = true
  log = true
  print = false
  print = false
  [current_teensy_0]
  [current_teensy_0]
  log = true
  log = true
  print = false
  print = false
  rate_ms = 10
  interval_ms = 10
  [distforce0]
  [distforce0]
  rate_ird_ms = 0
  interval_ird_ms = 0
  log_dist = true
  log_dist = true
  log_force = false
  log_force = false
  print = false
  print = false
  force = false
  force = false
  [gpio]
  [gpio]
  pins_out = 12=0 16=0
  pins_out = 12=0 16=0
Line 157: Line 207:
  print = false
  print = false
  use = false
  use = false
  [mixer]
  [mixer]
  use = true
  use = true
Line 167: Line 218:
  drive_gear = 1
  drive_gear = 1
  wheel_radius = 0.09
  wheel_radius = 0.09
  [joy_logitech]
  [joy_logitech]
  log = true
  log = true
Line 172: Line 224:
  device = /dev/input/js0
  device = /dev/input/js0
  device_type = Logitech Gamepad F710
  device_type = Logitech Gamepad F710
  [joy_use]
  [joy_use]
  log = true
  log = true
Line 185: Line 238:
  servo = 1
  servo = 1
  servoScale = 10
  servoScale = 10
  [ini]
  [ini]
  ; set 'saveconfig' to 'false' to avoid autosave =  
  ; set 'saveconfig' to 'false' to avoid autosave =  
  saveconfig = true
  saveconfig = true
  version = 853 2025-01-05 16:22:46
  version = 859 2025-01-07 08:37:26
  [edge0]
  [edge0]
  log = true
  log = true
  print = false
  print = false
  rate_liv_ms = 0
  interval_liv_ms = 0
  rate_livn_ms = 7
  interval_livn_ms = 10

Latest revision as of 17:48, 16 February 2025

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