Skip to content

Commit d6f2db6

Browse files
MaxWaterhoutMax Waterhout
andauthored
enable FCI and unlock Franka programmatically (#189)
Add franka_lock_unlock script --------- Signed-off-by: Max Waterhout <[email protected]> Signed-off-by: Max Waterhout <[email protected]> Co-authored-by: Max Waterhout <[email protected]>
1 parent 9b9f6ed commit d6f2db6

File tree

11 files changed

+176
-75
lines changed

11 files changed

+176
-75
lines changed

.devcontainer/.env

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# SPDX-FileCopyrightText: Alliander N. V.
2-
#
2+
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
PRE_COMMIT_HOME=/home/rcdt/rcdt_robotics/.cache/pre-commit
5+
# Define IGN_IP to use Gazebo with firewall enabled:
6+
IGN_IP=127.0.0.1
7+
8+
# Set QT_API to pyside6 for PyFlow to work:
9+
QT_API=pyside6
10+
11+
PRE_COMMIT_HOME=/home/rcdt/rcdt_robotics/.cache/pre-commit
12+
13+
# Set the RMW implementation to Cyclone DDS for communication with the Panther:
14+
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

.env

Lines changed: 0 additions & 12 deletions
This file was deleted.

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-FileCopyrightText: Alliander N. V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
FRANKA_HOSTNAME=10.15.20.4
6+
FRANKA_USERNAME=...
7+
FRANKA_PASSWORD=...

.github/workflows/reusable-workspace.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
shell: bash -ieo pipefail {0}
4141
run: |
4242
source /home/rcdt/.bashrc
43-
source .env
4443
cd ros2_ws
4544
source install/setup.bash
4645
echo "GZ_SIM_RESOURCE_PATH: ${GZ_SIM_RESOURCE_PATH}"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ ignore/
2020
.vscode-server
2121

2222
build/
23+
24+
.env
25+
!.devcontainer/.env
2326
.cache
24-
.venv
27+
.venv
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash -i
2+
3+
# SPDX-FileCopyrightText: Alliander N. V.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
mkdir -p /home/$UNAME/franka_lock_unlock/src
8+
cd /home/$UNAME/franka_lock_unlock
9+
git clone https://github.com/alliander-opensource/franka_lock_unlock.git
10+
11+
rosdep update
12+
rosdep install --from-paths src --rosdistro humble -y -i
13+
14+
source /home/$UNAME/.bashrc
15+
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
16+
echo "source /home/$UNAME/franka_lock_unlock/install/setup.bash" >>/home/$UNAME/.bashrc

dockerfiles/rcdt_robotics.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ RUN ./sensors.sh
3636
COPY ./install_scripts/sphinx.sh .
3737
RUN ./sphinx.sh
3838

39+
COPY ./install_scripts/franka_lock_unlock.sh .
40+
RUN ./franka_lock_unlock.sh
41+
3942
COPY ./install_scripts/dev_packages.sh .
4043
RUN ./dev_packages.sh
4144

docs/content/franka.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,38 @@ ros2 run rosboard rosboard_node
5353

5454
Running the brick pickup demo can be done in the same way.
5555

56-
## Setup & FCI activation of pysical robot
5756

58-
First plug an ehternet cable into your laptop, and connect it to the control box's LAN port (this is not the LAN port on the arm itself).
59-
Additionally, change your ethernet ipv4 settings to Manual and set the following:
60-
Address: `172.16.0.1`\
61-
Netmask: `255.255.255.0`
57+
## Setup & FCI activation of physical robot
6258

63-
![pyflow](../img/franka/network.png)
59+
### Programmatic unlock via `.env`
60+
61+
You can unlock the robot automatically without using the browser by setting environment variables in a `.env` file at the root of your workspace:
62+
63+
```dotenv
64+
# .env
65+
FRANKA_HOSTNAME=your-hostname
66+
FRANKA_USERNAME=your-username
67+
FRANKA_PASSWORD=your-password
68+
```
69+
70+
When you run the launch command, the robot will automatically unlock and activate the FCI.
71+
72+
This feature is based on the [jk-ethz/franka\_lock\_unlock](https://github.com/jk-ethz/franka_lock_unlock) repository. We maintain a fork with specific enhancements for our robot at [alliander-opensource/franka\_lock\_unlock](https://github.com/alliander-opensource/franka_lock_unlock.git).
73+
74+
### Manual unlock via web interface
75+
76+
You can also manually lock the robot via the web interface, plug an Ethernet cable from your laptop into the control box’s LAN port (this is not the LAN port on the arm itself). Additionally, change your Ethernet IPv4 settings to **Manual** and set the following:
77+
78+
```text
79+
Address: 172.16.0.1
80+
Netmask: 255.255.255.0
81+
```
82+
83+
![Network Setup](../img/franka/network.png)
6484

6585
You may also want to consider making this a separate profile for future convenience when moving to different networks.
6686

67-
If the robot's power switch is turned on, you should now be able to go to [https://172.16.0.2](https://172.16.0.2).
68-
Fill in the username and password, and click unlock.
69-
After that, click `My Franka Robot> Activate FCI`. The robot is now ready to be controlled by the user, and the commands in quickstart can be run.
87+
If the robot's power switch is turned on, you should now be able to go to [https://172.16.0.2](https://172.16.0.2).
88+
Fill in the username and password, and click **Unlock**. After that, click **My Franka Robot → Activate FCI**. The robot is now ready to be controlled by the user, and the commands in Quickstart can be run.
7089

7190
---TODO: screenshot here----

ros2_ws/src/rcdt_franka/launch/core.launch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
load_gazebo_ui_arg = LaunchArgument("load_gazebo_ui", False, [True, False])
1919
world_arg = LaunchArgument("world", "empty_camera.sdf")
2020
use_realsense_arg = LaunchArgument("realsense", False, [True, False])
21+
enable_lock_unlock_arg = LaunchArgument("franka_lock_unlock", True, [True, False])
2122

2223

2324
def launch_setup(context: LaunchContext) -> list:
@@ -34,6 +35,7 @@ def launch_setup(context: LaunchContext) -> list:
3435
load_gazebo_ui = load_gazebo_ui_arg.bool_value(context)
3536
world = str(world_arg.string_value(context))
3637
use_realsense = use_realsense_arg.bool_value(context)
38+
enable_lock_unlock = enable_lock_unlock_arg.bool_value(context)
3739

3840
namespace = "franka"
3941
frame_prefix = namespace + "/" if namespace else ""
@@ -66,7 +68,10 @@ def launch_setup(context: LaunchContext) -> list:
6668
)
6769
else:
6870
robot = RegisteredLaunchDescription(
69-
get_file_path("rcdt_franka", ["launch"], "robot.launch.py")
71+
get_file_path("rcdt_franka", ["launch"], "robot.launch.py"),
72+
launch_arguments={
73+
"franka_lock_unlock": str(enable_lock_unlock),
74+
},
7075
)
7176

7277
# Create a tf frame called 'base', required for the MotionPlanning plugin in Rviz:
@@ -102,6 +107,7 @@ def generate_launch_description() -> LaunchDescription:
102107
"""
103108
return LaunchDescription(
104109
[
110+
enable_lock_unlock_arg.declaration,
105111
use_sim_arg.declaration,
106112
parent_arg.declaration,
107113
load_gazebo_ui_arg.declaration,

ros2_ws/src/rcdt_franka/launch/franka.launch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"world", "table_with_1_brick.sdf", ["table_with_1_brick.sdf", "empty_camera.sdf"]
1616
)
1717
use_realsense_arg = LaunchArgument("realsense", False, [True, False])
18+
enable_lock_unlock_arg = LaunchArgument("franka_lock_unlock", True, [True, False])
1819

1920

2021
def launch_setup(context: LaunchContext) -> list:
@@ -31,6 +32,7 @@ def launch_setup(context: LaunchContext) -> list:
3132
use_rviz = use_rviz_arg.bool_value(context)
3233
world = str(world_arg.string_value(context))
3334
use_realsense = use_realsense_arg.bool_value(context)
35+
enable_lock_unlock = enable_lock_unlock_arg.bool_value(context)
3436

3537
namespace = "franka"
3638
ns = f"/{namespace}" if namespace else ""
@@ -42,6 +44,7 @@ def launch_setup(context: LaunchContext) -> list:
4244
"load_gazebo_ui": str(load_gazebo_ui),
4345
"realsense": str(use_realsense),
4446
"world": world,
47+
"franka_lock_unlock": str(enable_lock_unlock),
4548
},
4649
)
4750

@@ -110,6 +113,7 @@ def generate_launch_description() -> LaunchDescription:
110113
"""
111114
return LaunchDescription(
112115
[
116+
enable_lock_unlock_arg.declaration,
113117
use_sim_arg.declaration,
114118
load_gazebo_ui_arg.declaration,
115119
use_rviz_arg.declaration,

0 commit comments

Comments
 (0)