Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copy this file to '.env' and set the values.

# One of 'aalto', 'tubingen', 'usp_coil', 'usp_neurosoft', 'default'
# One of 'aalto', 'tubingen', 'usp_coil', 'usp_neurosoft', 'mpi', 'default'
SITE=

# One of 'elfin', 'elfin_new_api', 'dobot', 'ur', 'test'
# One of 'elfin', 'elfin_new_api', 'dobot', 'ur', 'omron', 'test'
ROBOT=

# Either 'true' or 'false'
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ Robotized transcranial magnetic stimulation controlled by InVesalius Navigator (

- Edit `.env` and set the robot type, site, and other configuration parameters.

## Omron TM5X-700

The Omron driver uses two interfaces on the TMFlow controller:

- **Modbus TCP** (port 502) for the pose, TCP speed, project state and emergency state.
- **TM script socket** (port 5890) for linear, circular and dynamic motion commands.

On the robot, enable the Modbus slave and a listen node on port 5890. Then set:

```bash
SITE=mpi
ROBOT=omron
```

`SITE=mpi` applies the 180 degree rz offset used by the MPI CBS cell. For another
cell, add a matching entry to `SITE_CONFIG` in `robot/constants.py`.

The robot IP is sent by InVesalius when you press **Connect to robot**. Install
the dependencies with `pip install -r requirements.txt`; this includes
`pymodbus`. Force and pressure sensing are provided by the separate sensor
stack, not by the Omron driver.

# Running

The first step is to run the relay_server.py script with an argument to set the server port
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- pynput
- pyserial
- python-dotenv
- pymodbus>=3.6,<4
- python-socketio==5.11.3
- uvicorn[standard]==0.30.1
- websocket-client
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ pynput
matplotlib==3.9.0
scipy==1.14.0
python-dotenv
pymodbus>=3.6,<4
30 changes: 30 additions & 0 deletions robot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"ry_offset": 0,
"rz_offset": 0,
},
# Omron TM5X-700 at MPI CBS: the coil needs a 180 degree rz offset.
"mpi": {
"rx_offset": 0,
"ry_offset": 0,
"rz_offset": 180,
},
"default": {
"rx_offset": 0,
"ry_offset": 0,
Expand Down Expand Up @@ -138,6 +144,30 @@
"force_sensor_threshold": 10,
"force_sensor_scale_threshold": 30,
},
"omron": {
# General
# The MPI cell uses a 1200 mm working-space limit.
"working_space_radius": 1200,
# The main loop polls several Modbus registers; do not spin flat out.
"sleep": 0.02,
# Head motion
"head_velocity_threshold": 60,
# Tuning motion
"distance_threshold_for_tuning": 30,
"angular_distance_threshold_for_tuning": 5,
# Arc motion
"distance_threshold_for_arc_motion": 80,
"angular_distance_threshold_for_arc_motion": 30,
"arc_bezier_curve_step": None,
"threshold_to_update_arc_motion_target": 40,
"versor_scale_factor": 50,
"middle_arc_scale_factor": 1.5,
# Robot tracker registration
"transformation_matrix_threshold": 1,
# Force and torque sensor
"force_sensor_threshold": 10,
"force_sensor_scale_threshold": 30,
},
}

# Publisher messages from invesalius to any robot
Expand Down
7 changes: 7 additions & 0 deletions robot/control/robot_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@ def connect_to_robot(self, robot_ip):
robot = ur.UniversalRobot(robot_ip)
success = robot.connect()

elif robot_type == "omron":
# Imported lazily so the other robots do not require pymodbus.
import robot.robots.omron.omron as omron

robot = omron.Omron(robot_ip)
success = robot.connect()

elif robot_type == "test":
# TODO: Add 'test' robot here.
pass
Expand Down
Loading
Loading