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
40 changes: 21 additions & 19 deletions website/docs/software/setup/2-can-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ The [electrical BOM](/hardware/bill-of-materials/electrical) contains the device
Before proceeding, ensure you have the required tools installed:

```bash
sudo apt install can-utils iproute2
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:openarm/main
sudo apt update
sudo apt install -y \
can-utils \
iproute2 \
libopenarm-can-dev \
openarm-can-utils
```

## Find Your CAN Interface
Expand All @@ -28,7 +35,19 @@ ip link show

Replace `can0` with your actual CAN interface name and use a baudrate supported by you interfaces for the steps.

### Option 1: setup manually
### Option 1: use OpenArm CAN library

The OpenArm CAN library includes convenient setup commands, example usage:

```bash
# For CAN 2.0
openarm-can-configure-socketcan can0

# For CAN FD at 5mbps (recommended)
openarm-can-configure-socketcan can0 -fd -b 1000000 -d 5000000
```

### Option 2: setup manually

**CAN 2.0 Mode**

Expand All @@ -47,23 +66,6 @@ sudo ip link set can0 type can bitrate 1000000 dbitrate 5000000 fd on
sudo ip link set can0 up
```

### Option 2: use setup scripts

The OpenArm CAN library includes convenient setup scripts, example usage:

```bash
# Navigate to openarm_can directory
wget https://github.com/enactic/openarm_can/releases/download/{{OPENARM_CAN_VERSION}}/openarm-can-{{OPENARM_CAN_VERSION}}.tar.gz
tar xf openarm-can-{{OPENARM_CAN_VERSION}}.tar.gz
cd openarm-can-{{OPENARM_CAN_VERSION}}/setup

# For CAN 2.0
./configure_socketcan.sh can0

# For CAN FD at 5mbps (recommended)
./configure_socketcan.sh can0 -fd -b 1000000 -d 5000000
```

## Verify Configuration

Check that your CAN interface is properly configured:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---
title: '5. Motor Configuration'
sidebar_position: 6
title: '4. Motor Configuration'
sidebar_position: 5
---
import BlockImage from '@site/src/components/BlockImage';

# Step 5: Motor Configuration
# Step 4: Motor Configuration

:::info
**Prerequisites:** Before proceeding, ensure you have:
- ✅ Motor IDs configured (Step 1)
- ✅ CAN interface configured (Step 2)
- ✅ Basic communication tested (Step 3)
- ✅ OpenArm CAN library built (Step 4)
:::

## Overview
Expand All @@ -33,13 +32,13 @@ Set the baudrate for each motor (replace `1` with your motor CAN ID and `5000000

Set temporarily:
```bash
python3 change_baudrate.py --baudrate 5000000 --canid 1 --socketcan can0
openarm-can-change-baudrate --baudrate 5000000 --canid 1 --socketcan can0
```

Save permanently:

```bash
python3 change_baudrate.py --baudrate 5000000 --canid 1 --socketcan can0 --flash
openarm-can-change-baudrate --baudrate 5000000 --canid 1 --socketcan can0 --flash
```

**Important:** After completing the baudrate configuration, reconfigure your CAN interface to match the motor's new baudrate setting for proper communication if necessary.
Expand Down Expand Up @@ -70,25 +69,23 @@ For grippers, the closed position is used as zero by default.
Safety First! The robot will move automatically when calibration starts. Wear safety gear, clear the workspace, and be ready to emergency stop.
:::

**Prerequisites:** Ensure you have completed the [Python binding](https://github.com/enactic/openarm_can#4-python--experimental---temporary-) installation before proceeding with calibration.

The zero position calibration runs **one arm at a time**.
Run the zero position calibration (this defaults to can 0, right arm):
```bash
python3 setup/zero_position_calibration.py
openarm-can-zero-position-calibration
```
For specific arms, run:
```bash
# Leader-side Left
python3 setup/zero_position_calibration.py --canport can1 --arm_side left_arm
openarm-can-zero-position-calibration --canport can1 --arm_side left_arm
```
```bash
# Follower-side Right
python3 setup/zero_position_calibration.py --canport can2 --arm_side right_arm
openarm-can-zero-position-calibration --canport can2 --arm_side right_arm
```
```bash
# Follower-side Left
python3 setup/zero_position_calibration.py --canport can3 --arm_side left_arm
openarm-can-zero-position-calibration --canport can3 --arm_side left_arm
```
<div style={{display: 'flex', justifyContent: 'center'}}>
<iframe
Expand All @@ -108,18 +105,16 @@ python3 setup/zero_position_calibration.py --canport can3 --arm_side left_arm
## Step 3: Verify Motor Communication

Run the motor check executable, replace `1` and `17` with your motor's send and receive CAN IDs.
The `motor-check` executable should be available in the build directory from the library compilation.
If it's missing, rebuild the project. Note: CAN ID 17 is the decimal representation of 0x11
Note: CAN ID 17 is the decimal representation of 0x11

For CAN 2.0
```bash
cd openarm_can/build
./motor-check 1 17 can0
openarm-can-motor-check 1 17 can0
```

For CAN FD mode:
```bash
./motor-check 1 17 can0 -fd
openarm-can-motor-check 1 17 can0 -fd
```

The output should display the motor's receiver ID, baudrate, and status information.
Expand All @@ -130,7 +125,7 @@ The output should display the motor's receiver ID, baudrate, and status informat
3. **Troubleshoot**: If the baudrate doesn't match, switch your CAN interface to 2.0 and re-run the baudrate change script

:::warning
It is important to get the motor-check working before running the demo.
It is important to get the openarm-can-motor-check working before running the demo.
:::

## Troubleshooting
Expand Down
40 changes: 0 additions & 40 deletions website/docs/software/setup/4-software-setup.mdx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
title: '6. Hands-On: Demo Run'
sidebar_position: 7
title: '5. Hands-On: Demo Run'
sidebar_position: 6
---

# Step 6: Hands-On: Demo Run
# Step 5: Hands-On: Demo Run

:::info
**Prerequisites:** Before running the demo, verify these prerequisites are complete:
- ✅ Motor IDs configured and tested (Steps 1, 3)
- ✅ CAN interface configured (Step 2)
- ✅ OpenArm CAN library built (Step 4)
- ✅ Motor zero position set to safe values, baudrate matches CAN interface configuration (Step 5)
- ✅ Motor zero position set to safe values, baudrate matches CAN interface configuration (Step 4)
:::

Now that your basic communication is working, let's run the full OpenArm demo program to test complete system functionality.
Expand All @@ -34,12 +33,71 @@ Connect the motors in a daisy-chain using XT30 2+2 cables. [See detailed wiring
The default demo uses motors 0x01, 0x02, 0x07 (DM4310) on CAN0 with CANFD. If your setup matches, run directly:

```bash
./build/openarm-demo
openarm-can-demo
```

## What the Demo Does

The demo program performs these operations:

1. **Initialization**: Sets up CAN interface and motor communication
2. **Motor Query**: Reads and displays motor IDs to verify configuration
3. **Motor Control**:
- Enables all motors
- Performs position control tests
- Performs torque control tests
4. **Gripper Control**: Opens and closes the gripper (if configured)
5. **Status Monitoring**: Displays motor positions for 10 cycles
6. **Cleanup**: Safely disables all motors

Modify the configuration as needed for your setup.

## Expected Output

You should see output similar to:

```
=== OpenArm CAN Example ===
This example demonstrates the OpenArm API functionality
Initializing OpenArm CAN...
Initializing gripper...

=== Enabling Motors ===

=== Querying Motor Recv IDs ===
Arm Motor: 1 ID: 17
Arm Motor: 2 ID: 18
Gripper Motor: 8 ID: 24

=== Controlling Motors ===
Closing gripper...
Arm Motor: 1 position: 0.123
Arm Motor: 2 position: 0.456
Gripper Motor: 8 position: 0.789
...
```

## Configure the Demo

Configured with your specific motor setup by editing `openarm_can/examples` and rebuild if needed.
### Prerequisites

Before proceeding, ensure you have the required system:

- Linux with SocketCAN support ([Install Ubuntu →](../ubuntu/))
- CMake 3.22+
- C++17 compiler

### Download the CAN Library

```bash
wget https://github.com/enactic/openarm_can/releases/download/{{OPENARM_CAN_VERSION}}/openarm-can-{{OPENARM_CAN_VERSION}}.tar.gz
tar xf openarm-can-{{OPENARM_CAN_VERSION}}.tar.gz
cd openarm-can-{{OPENARM_CAN_VERSION}}
```

### Configure the Demo

Configured with your specific motor setup by editing `examples/demo.cpp` and build if needed.
Find and update these sections to match your motor setup:

```cpp
Expand Down Expand Up @@ -83,61 +141,19 @@ If you have a gripper, update the gripper configuration. Otherwise, remove all c
openarm.init_gripper_motor(openarm::damiao_motor::MotorType::DM4310, 0x08, 0x18);
```

### Build the Demo

## What the Demo Does

The demo program performs these operations:

1. **Initialization**: Sets up CAN interface and motor communication
2. **Motor Query**: Reads and displays motor IDs to verify configuration
3. **Motor Control**:
- Enables all motors
- Performs position control tests
- Performs torque control tests
4. **Gripper Control**: Opens and closes the gripper (if configured)
5. **Status Monitoring**: Displays motor positions for 10 cycles
6. **Cleanup**: Safely disables all motors

Modify the configuration as needed for your setup.

## Rebuild the Demo

After modifying the configuration, rebuild the demo:
After modifying the configuration, build the demo:

```bash
cmake --build build --target openarm-demo
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target openarm-can-demo
```

## Run the Demo
### Run the Demo

```bash
cd build
./openarm-demo
```

## Expected Output

You should see output similar to:

```
=== OpenArm CAN Example ===
This example demonstrates the OpenArm API functionality
Initializing OpenArm CAN...
Initializing gripper...

=== Enabling Motors ===

=== Querying Motor Recv IDs ===
Arm Motor: 1 ID: 17
Arm Motor: 2 ID: 18
Gripper Motor: 8 ID: 24

=== Controlling Motors ===
Closing gripper...
Arm Motor: 1 position: 0.123
Arm Motor: 2 position: 0.456
Gripper Motor: 8 position: 0.789
...
build/openarm-can-demo
```

## Troubleshooting
Expand Down
Loading