Skip to content

Commit 632f567

Browse files
committed
fix env
1 parent 743e551 commit 632f567

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A Python client library for interacting with [I2RT](https://i2rt.com/) products,
1616
pip install -e .
1717
```
1818

19-
## CAN Usage
19+
## Basic CAN Usage
2020
Plug in the CAN device and run the following command to check the available CAN devices.
2121
```bash
2222
ls -l /sys/class/net/can*
@@ -39,6 +39,15 @@ We have provided a convenience script to reset all CAN devices. Simply run
3939
sh scripts/reset_all_can.sh
4040
```
4141

42+
### See [set_persist_id_socket_can.md](doc/set_persist_id_socket_can.md) if you want to set persistent CAN device names
43+
44+
## Test YAM Zero Gravity mode
45+
46+
```bash
47+
python i2rt/robots/motor_chain_robot.py --model yam --channel can0 --operation_mode gravity_comp
48+
```
49+
50+
4251
## YAM Robot Arm Usage
4352

4453
### Getting started

doc/set_persist_id_socket_can.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Socket can is easy to use, but the default devie name is can{idx} and will vary depend on the order the device got connected to the computer. Below is the precedure of setting up persist ID for those socket CAN devices.
2+
3+
## For canable devices, goto https://canable.io/updater/ to flush its firmware to candlelight to use socketcan, YAM comes with pre-flushed candlelight firmware.
4+
5+
6+
## Step1: find sysfd paths for can devices
7+
8+
```shell
9+
$ ls -l /sys/class/net/can*
10+
```
11+
12+
this should give you something liks
13+
```shell
14+
lrwxrwxrwx 1 root root 0 Jul 15 14:35 /sys/class/net/can0 -> ../../devices/platform/soc/your_can_device/can0
15+
lrwxrwxrwx 1 root root 0 Jul 15 14:35 /sys/class/net/can1 -> ../../devices/platform/soc/your_can_device/can1
16+
lrwxrwxrwx 1 root root 0 Jul 15 14:35 /sys/class/net/can2 -> ../../devices/platform/soc/your_can_device/can2
17+
```
18+
19+
## Step 2: Use udevadm to Gather Attributes
20+
```shell
21+
udevadm info -a -p /sys/class/net/can0 | grep -i serial
22+
```
23+
24+
## Step 3: Create udev Rules
25+
edit `/etc/udev/rules.d/90-can.rules`
26+
```shell
27+
sudo vim /etc/udev/rules.d/90-can.rules
28+
```
29+
add
30+
```
31+
SUBSYSTEM=="net", ACTION=="add", ATTRS{serial}=="004E00275548501220373234", NAME="can_follow_l"
32+
SUBSYSTEM=="net", ACTION=="add", ATTRS{serial}=="0031005F5548501220373234", NAME="can_follow_r"
33+
```
34+
35+
IMPORTANT!!!: Name should start with can (for USB-CAN adapter) or en/eth (for EtherCAT-CAN adapter). And the maximum length limit for a CAN interface name is 13 characters.
36+
37+
## Step 4: Reload udev Rules
38+
```shell
39+
sudo udevadm control --reload-rules && sudo systemctl restart systemd-udevd && sudo udevadm trigger
40+
```
41+
42+
If needed, plug unplug the candevice to make sure the change is effective.
43+
44+
run the following command to set up the can device, and you need to run this command after every reboot.
45+
```
46+
sudo ip link set up can_right type can bitrate 1000000
47+
```
48+
49+
## Step 5: Verify the can device
50+
```shell
51+
$ ip link show
52+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
53+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
54+
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
55+
link/ether d8:43:ae:b7:43:0b brd ff:ff:ff:ff:ff:ff
56+
5: tailscale0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 500
57+
link/none
58+
6: can_right: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
59+
link/can
60+
7: can_left: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
61+
link/can
62+
```
63+
64+
You can see that this can device got it's name can_right/can_left
65+

i2rt/robots/motor_chain_robot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
YAM_XML_PATH = os.path.join(I2RT_ROOT, "robot_models/yam/yam.urdf")
2222
ARX_XML_PATH = os.path.join(I2RT_ROOT, "robot_models/arx_r5/arx.urdf")
2323

24+
2425
@dataclass
2526
class JointStates:
2627
names: List[str]
@@ -224,7 +225,7 @@ def update(self) -> None:
224225

225226
joint_commands.pos[self._gripper_index] = self._gripper_force_limiter.update(gripper_state)
226227

227-
# add final clip so the gripper won't be over-adjusted
228+
# add final clip so the gripper won't be over-adjusted
228229
joint_commands.pos[self._gripper_index] = np.clip(
229230
joint_commands.pos[self._gripper_index],
230231
min(self._gripper_limits),
@@ -396,7 +397,7 @@ def get_yam_robot(channel: str = "can0", model_path: str = YAM_XML_PATH) -> Moto
396397
[0x01, "DM4340"],
397398
[0x02, "DM4340"],
398399
[0x03, "DM4340"],
399-
[0x04, "DM4340"],
400+
[0x04, "DM4310"],
400401
[0x05, "DM4310"],
401402
[0x06, "DM4310"],
402403
[0x07, "DM4310"],

0 commit comments

Comments
 (0)