Sawyer NUC Setup¶
Description¶
The NUC or control PC runs the following processes to control the Rethink Sawyer Arm
redis-server: An in-memory database used by perls2 for interprocess communication. Hosted on the NUC and communicated with via tcp. Allows the
perls2.SawyerCtrlInterface
to bridge theperls2.Env
on the WS withintera
. See the Redis Help for more on Redis and perls2.ROSRedisPublisher: Ros node that updates redis with robot state from intera.
perls2 SawyerCtrlInterface: Process that implements the robot controller.
Robot commands and controller params are obtained from the WS.
Robot state is obtained from the franka-panda-iprl driver.
The
SaywerCtrlInterface
uses these to calculate the torques required to acheive desired robot state, and send them as a ROS JointCommand msg.
JointStatePublisherRate node Node that commands Sawyer to publish its joint state at maximum 800 Hz instead of default 500 Hz.
Important notes:¶
To ensure consistent control loop timing, it is important that no other processes be running on the NUC. This includes internet browsers or text editors. After initial set up, the NUC should be accessed only by ssh from the workstation.
Setting up the NUC¶
Some of these instructions use the Franka website, but they still apply for REthink Sawyer
Disable cpu power scaling using cpufrequtils by following the [instructions here] The default setting slow down the CPU frequency for power conservation. We want our control loop to run as fast as possible to maintain a high frequency for torque control.
Install dependencies
sudo apt-get install
Clone perls2
git clone https://github.com/StanfordVL/perls2.git
Install redis.
sudo apt-get install redis-server
Bind your redis-server to secure it.
Bind your redis server¶
Binding the redis-server ensures that it only allows connections from certain ip addresses. This allows us to secure the redis-server for a local network.
Determine the control PC’s local ip address. If you followed the instructions on the Franka website, it should be 172.16.0.1. Otherwise use ifconfig. Note the inet addr for the local network, likely ‘eno1’. For example:
$ ifconfig
eno1 Link encap:Ethernet HWaddr 94:c6:91:aa:91:80
inet addr:172.16.0.1 Bcast:172.16.0.255 Mask:255.255.255.0
Using your favorite text editor, open the
redis.conf
file found in the local directory you just copied.cd ~/perls2_local_control_pc nano redis.conf
Set up for bash scripting¶
Configuring the local_dirs.sh
file makes it convenient to start the robot by using bash scripts.
In the perls2_local_control_pc directory, open the local_dirs.sh file.
cd ~/perls2_local_control_pc nano local_dirs.sh
Edit following variables in the script with directories and file locations specific to your pc. If you set up everything in your home directory, you shouldn’t have to modify anything.
# ROS WS directory
export ROS_DIR="$HOME/ros_ws"
# Command to source ROS
export SOURCE_ROS_CMD="source /opt/ros/kinetic/setup.bash"
export SOURCE_INTERA_CMD="cd ${ROS_DIR}; ./intera.sh"
# Source python 2.7 environment
export SOURCE_P27ENV_CMD="source ~/p27env/bin/activate"
Make the file executable with:
chmod a+x local_dirs.sh
Verify perls2 NUC setup using bash scripts:¶
Turn on the Sawyer by pressing the power button on the computer attached to the Sawyer. After some time the eyes should appear and then disappear and the robot arm should move slightly.
Move to the perls2 directory.
cd ~/perls2
Run the
start_panda_control.sh
script passing the path to theperls2_local_control_pc
folder you copied as an argument:./scripts/start_sawyer_control.sh ~/perls2_local_control_pc
The robot arm should reset to a neutral position and you should see the message:
Waiting for perls2.RobotInterface to connect
Exit the Ctrl Interface with
[Ctrl + B :] kill-session