diff --git a/stretch_body/tutorial_collision_avoidance.md b/stretch_body/tutorial_collision_avoidance.md index 1403af9..40cf6af 100644 --- a/stretch_body/tutorial_collision_avoidance.md +++ b/stretch_body/tutorial_collision_avoidance.md @@ -11,14 +11,18 @@ Stretch Body includes a system to prevent inadvertent self-collisions. It will This system is turned off by default starting with Stretch 2. It may be turned off by default on many RE1 systems. First check if the collision detection system is turned on: -```bash ->>$ stretch_params.py | grep use_collision_manager +```{.bash .shell-prompt} +stretch_params.py | grep use_collision_manager +``` + +Output: +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.robot.use_collision_manager 1 ``` If it is turned off you can enable it by adding the following to your stretch_user_yaml.py: -```bash +```{.bash .no-copy} robot: use_collision_manager: 1 ``` @@ -37,8 +41,12 @@ Fortunately, the simple kinematics of Stretch make self-collisions fairly uncomm The collision avoidance system works by dynamically modifying the acceptable range of motion for each joint. By default, a joint's range is set to the physical hard stop limits. For example, the lift has a mechanical throw of 1.1m: -```bash ->>$stretch_params.py | grep range | grep lift +```{.bash .shell-prompt} +stretch_params.py | grep range | grep lift +``` + +Output: +```{.bash .no-copy} stretch_body.robot_params.factory_params param.lift.range_m [0.0, 1.1] ``` @@ -78,11 +86,14 @@ The [RobotCollision](https://github.com/hello-robot/stretch_body/blob/master/bod We can see which collision models will execute when `use_collision_manager` is set to 1: -```bash ->>$ stretch_params.py | grep collision | grep enabled +```{.bash .shell-prompt} +stretch_params.py | grep collision | grep enabled +``` + +Output: +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.collision_arm_camera.enabled 1 stretch_body.robot_params.nominal_params param.collision_stretch_gripper.enabled 1 - ``` We see two models. One that protects the camera from the arm, and one that protects the base from the gripper. Each model is registered with the [RobotCollision](https://github.com/hello-robot/stretch_body/blob/master/body/stretch_body/robot_collision.py) instance as a loadable plug-in. The [Robot](https://github.com/hello-robot/stretch_body/blob/master/body/stretch_body/robot.py) class calls the `RobotCollision.step` method periodically at approximately 10hz. @@ -218,8 +229,8 @@ In this example, we include the `safety_margin` as a way to introduce some hyste The following command should be run to add the working directory to the PYTHONPATH env. This can also be added to our `.bashrc` to permanently edit the path: -```bash ->>$ export PYTHONPATH=$PYTHONPATH:/ +```{.bash .shell-prompt} +export PYTHONPATH=$PYTHONPATH:/ ``` Next, we configure RobotCollision to use our CollisionArmTable model in `stretch_re1_user_yaml`: @@ -238,8 +249,8 @@ collision_arm_table: Finally, test out the model by driving the arm and lift around using the Xbox teleoperation tool: -```bash ->>$ stretch_xbox_controller_teleop.py +```{.bash .shell-prompt} +stretch_xbox_controller_teleop.py ``` ------ diff --git a/stretch_body/tutorial_command_line_tools.md b/stretch_body/tutorial_command_line_tools.md index ffa87ae..6ebeed8 100644 --- a/stretch_body/tutorial_command_line_tools.md +++ b/stretch_body/tutorial_command_line_tools.md @@ -6,8 +6,8 @@ These tools are useful when developing and debugging applications. They also ser These tools can be found by tab completion of 'stretch_' from a terminal. -```console -$ stretch_ +```{.bash .shell-prompt} +stretch_ stretch_about.py stretch_about_text.py @@ -47,8 +47,12 @@ stretch_xbox_controller_teleop.py All tools accept the '--help' flag as a command line argument to describe its function. For example: -```console ->>$ stretch_pimu_scope.py --help +```{.bash .shell-prompt} +stretch_pimu_scope.py --help +``` + +Output: +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- diff --git a/stretch_body/tutorial_contact_models.md b/stretch_body/tutorial_contact_models.md index 82e2a0a..b48b288 100644 --- a/stretch_body/tutorial_contact_models.md +++ b/stretch_body/tutorial_contact_models.md @@ -59,8 +59,10 @@ In this method, you can optionally specify a contact threshold in the positive a !!! warning The parameters `contact_thresh_pos_N` and `contact_thresh_neg_N` are deprecated and no longer supported. -```bash ->>$ stretch_params.py | grep arm | grep contact +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep contact +``` +```{.bash .no-copy} ... stretch_configuration_params.yaml param.arm.contact_models.effort_pct.contact_thresh_default [-45.0, 45.0] ... @@ -140,8 +142,10 @@ The Stretch Factory package provides a tool to allow advanced users to recalibra The tool sweeps the joint through its range of motion for `n-cycle` iterations. It computes the maximum contact forces in both directions, adds padding, `contact_thresh_calibration_margin`, to this value, and stores it to the robot's configuration YAML. -```bash ->>$ REx_calibrate_guarded_contact.py -h +```{.bash .shell-prompt} +REx_calibrate_guarded_contact.py -h +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- diff --git a/stretch_body/tutorial_dynamixel_servos.md b/stretch_body/tutorial_dynamixel_servos.md index 5313670..899f796 100644 --- a/stretch_body/tutorial_dynamixel_servos.md +++ b/stretch_body/tutorial_dynamixel_servos.md @@ -6,8 +6,12 @@ In this tutorial, we will go into the details with Dynamixel servos and Stretch. Stretch comes with two Dynamixel buses - one for the head and one for the end-of-arm: -```bash ->>$ ls /dev/hello-dynamixel-* +```{.bash .shell-prompt} +ls /dev/hello-dynamixel-* +``` + +Output: +```{.bash .no-copy} /dev/hello-dynamixel-head /dev/hello-dynamixel-wrist ``` @@ -22,8 +26,12 @@ Typically, users will interact with these devices through either the [Head](http You can directly command each servo using the command line tool `REx_dynamixel_servo_jog.py`. This can be useful for debugging new servos added to the end-of-arm tool during system bring-up. For example, to command the head pan servo: -```bash -$ REx_dynamixel_jog.py /dev/hello-dynamixel-head 11 +```{.bash .shell-prompt} +REx_dynamixel_jog.py /dev/hello-dynamixel-head 11 +``` + +Output: +```{.bash .no-copy} [Dynamixel ID:011] ping Succeeded. Dynamixel model number : 1080 ------ MENU ------- m: menu @@ -51,8 +59,12 @@ e: enable torque Under high-load conditions, the servos may enter an error state to protect themselves from thermal overload. In this case, the red LED on the servo will flash (if visible). In addition, the servo will be unresponsive to motion commands. In this case, allow the overheating servo to cool down and reboot the servos using the `stretch_robot_dynamixel_reboot.py` tool: -```bash -$ stretch_robot_dynamixel_reboot.py +```{.bash .shell-prompt} +stretch_robot_dynamixel_reboot.py +``` + +Output: +```{.bash .no-copy} For use with S T R E T C H (TM) RESEARCH EDITION from Hello Robot Inc. ---- Rebooting Head ---- @@ -67,8 +79,12 @@ For use with S T R E T C H (TM) RESEARCH EDITION from Hello Robot Inc. If it is unclear which servos are on the bus, and at what baud rate, you can use the `REx_dynamixel_id_scan.py` tool. Here we see that the two head servos are at ID `11` and `12` at baud `57600`. -```bash -$ REx_dynamixel_id_scan.py /dev/hello-dynamixel-head --baud 57600 +```{.bash .shell-prompt} +REx_dynamixel_id_scan.py /dev/hello-dynamixel-head --baud 57600 +``` + +Output: +```{.bash .no-copy} Scanning bus /dev/hello-dynamixel-head at baud rate 57600 ---------------------------------------------------------- [Dynamixel ID:000] ping Failed. @@ -102,8 +118,12 @@ Scanning bus /dev/hello-dynamixel-head at baud rate 57600 Stretch ships with its Dynamixel servos configured to `baudrate=115200`. When adding your servos to the end-of-arm tool, you may want to set the servo baud using the `REx_dynamixel_set_baud.py` tool. For example: -```bash -$ REx_dynamixel_set_baud.py /dev/hello-dynamixel-wrist 13 115200 +```{.bash .shell-prompt} +REx_dynamixel_set_baud.py /dev/hello-dynamixel-wrist 13 115200 +``` + +Output: +```{.bash .no-copy} --------------------- Checking servo current baud for 57600 ---- @@ -118,8 +138,12 @@ Success at changing baud Dynamixel servos come with `ID=1` from the factory. When adding your servos to the end-of-arm tool, you may want to set the servo ID using the `REx_dynamixel_id_change.py` tool. For example: -```bash -$ REx_dynamixel_id_change.py /dev/hello-dynamixel-wrist 1 13 --baud 115200 +```{.bash .shell-prompt} +REx_dynamixel_id_change.py /dev/hello-dynamixel-wrist 1 13 --baud 115200 +``` + +Output: +```{.bash .no-copy} [Dynamixel ID:001] ping Succeeded. Dynamixel model number : 1080 Ready to change ID 1 to 13. Hit enter to continue: @@ -150,13 +174,17 @@ The [EndOfArm](https://github.com/hello-robot/stretch_body/blob/master/body/stre DynamixelHelloXL430 provides an interface to servo motion that is consistent with the Stretch Body lift, arm, and base joints. It also manages the servo parameters and calibration. Let's explore this interface further. From iPython, let's look at the status message for DynamixelHelloXL430 -```bash +```python import stretch_body.dynamixel_hello_XL430 m = stretch_body.dynamixel_hello_XL430.DynamixelHelloXL430('head_pan') m.startup() m.pretty_print() +``` + +Output: +```{.python .no-copy} ----- HelloXL430 ------ Name head_pan Position (rad) -0.0 @@ -181,14 +209,16 @@ Range (rad) [ 1.9174759848570513 , -3.953068490381297 ] Stalled True Stall Overload False Is Calibrated 0 - ``` We see that it reports the position in both radians (with respect to the joint frame) and ticks (with respect to the servo encoder). DynamixelHelloXL430 handles the calibration between the two using its method `ticks_to_world_rad` through the following params: -```bash ->>$ stretch_params.py | grep head_pan | grep '_t ' -... +```{.bash .shell-prompt} +stretch_params.py | grep head_pan | grep '_t ' +``` + +Output: +```{.bash .no-copy} stretch_configuration_params.yaml param.head_pan.range_t [0, 3827] stretch_configuration_params.yaml param.head_pan.zero_t 1250 ``` diff --git a/stretch_body/tutorial_introduction.md b/stretch_body/tutorial_introduction.md index d6db6d5..e257191 100644 --- a/stretch_body/tutorial_introduction.md +++ b/stretch_body/tutorial_introduction.md @@ -28,9 +28,8 @@ Stretch also includes 3rd party hardware devices that are not accessible through The primary developer interface to Stretch_Body is the [Robot class](https://github.com/hello-robot/stretch_body/blob/master/body/stretch_body/robot.py). Let's write some code to explore the interface. Launch an interactive Python terminal: -```bash ->>$ ipython -In [1]: +```{.bash .shell-prompt} +ipython ``` Then type in the following: diff --git a/stretch_body/tutorial_parameter_management.md b/stretch_body/tutorial_parameter_management.md index aaee414..3195a86 100644 --- a/stretch_body/tutorial_parameter_management.md +++ b/stretch_body/tutorial_parameter_management.md @@ -11,6 +11,9 @@ import stretch_body.arm a=stretch_body.arm.Arm() a.params +``` + +```{.python .no-copy} Out[7]: {'chain_pitch': 0.0167, 'chain_sprocket_teeth': 10, @@ -35,7 +38,9 @@ or to access another device params: ```python a.robot_params['lift'] +``` +```{.python .no-copy} Out[9]: {'calibration_range_bounds': [1.094, 1.106], 'contact_model': 'effort_pct', @@ -71,9 +76,11 @@ Stretch Body utilizes a prioritized parameter organization such that default set The tool `stretch_params.py` will print out all of the robot parameters as well as their origin. For example: -```bash ->>$stretch_params.py -############################################################ Parameters for stretch-re2-2002 +```{.bash .shell-prompt} +stretch_params.py +``` +```{.bash .no-copy} +############################################################ Parameters for stretch-re2-xxxx Origin Parameter Value --------------------------------------------------------------------------------------------------------------------------------- ... stretch_body.robot_params.nominal_params param.arm.chain_pitch 0.0167 @@ -85,8 +92,10 @@ stretch_configuration_params.yaml param.arm.contact_models.effort_pct.cont A quick way to query parameters is with the `stretch_params.py` tool. For example, to look at parameters relating to the arm motion: -```bash ->>$ stretch_params.py | grep arm | grep motion +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep motion +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.arm.motion.default.accel_m 0.14 stretch_body.robot_params.nominal_params param.arm.motion.default.vel_m 0.14 stretch_body.robot_params.nominal_params param.arm.motion.fast.accel_m 0.3 @@ -112,8 +121,10 @@ arm: Run the tool again and we see: -```bash ->>$ stretch_params.py | grep arm | grep motion | grep default +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep motion | grep default +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.arm.motion.default.accel_m 0.1 stretch_body.robot_params.nominal_params param.arm.motion.default.vel_m 0.1 ``` diff --git a/stretch_body/tutorial_robot_motion.md b/stretch_body/tutorial_robot_motion.md index df6e9b3..fabf58d 100644 --- a/stretch_body/tutorial_robot_motion.md +++ b/stretch_body/tutorial_robot_motion.md @@ -66,11 +66,12 @@ All joints support [trapezoidal motion profile](https://www.motioncontroltips.co We provide 'defaults' for the velocity and acceleration settings, as well as 'fast', and 'slow' settings. These values have been tuned to be appropriate for the safe movement of the robot. These values can be queried using the `stretch_params.py` tool: -```bash ->>$stretch_params.py | grep arm | grep motion | grep default +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep motion | grep default +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.arm.motion.fast.accel_m 0.14 -stretch_body.robot_params.nominal_params param.arm.motion.fast.vel_m 0.14 - +stretch_body.robot_params.nominal_params param.arm.motion.fast.vel_m 0.14 ``` We see that the arm motion in 'default' mode will move with a velocity of 0.14 m/s and an acceleration of 0.14 m/s^2. @@ -91,8 +92,10 @@ The motion will use the 'default' motion profile settings if no values are speci All joints obey motion limits which are specified in the robot parameters. -```bash ->>$ stretch_params.py | grep arm | grep range_m +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep range_m +``` +```{.bash .no-copy} stretch_user_params.yaml param.arm.range_m [0.0, 0.515] ``` diff --git a/stretch_body/tutorial_robot_sensors.md b/stretch_body/tutorial_robot_sensors.md index be83439..f73a705 100644 --- a/stretch_body/tutorial_robot_sensors.md +++ b/stretch_body/tutorial_robot_sensors.md @@ -8,8 +8,10 @@ Stretch Body exposes a host of sensor data through the status dictionaries of it There are two useful tools for scoping Pimu and Wacc sensor data in real-time: -```bash ->>$ stretch_pimu_scope.py --help +```{.bash .shell-prompt} +stretch_pimu_scope.py --help +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- @@ -41,8 +43,10 @@ optional arguments: and, -```bash ->>$ stretch_wacc_scope.py --help +```{.bash .shell-prompt} +stretch_wacc_scope.py --help +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- @@ -64,8 +68,10 @@ optional arguments: Each motor also has associated sensor data available in its status dictionaries. The corresponding 'jog' tool for each joint will pretty-print the sensor data for that motor to the console. For example: -```bash ->>$ stretch_arm_jog.py +```{.bash .shell-prompt} +stretch_arm_jog.py +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- ... @@ -133,8 +139,7 @@ r=stretch_body.robot.Robot() r.startup() for i in range(10): print('Arm position (m)%f'%r.arm.status['pos']) - time.sleep(0.1) - + time.sleep(0.1) ``` ## Base IMU @@ -187,7 +192,6 @@ QZ 0.023505505174398422 Roll (deg) 2.095733642578125 Pitch (deg) -1.6964653730392456 Heading (deg) 73.26100921630858 - ``` It reports: @@ -202,8 +206,10 @@ These values are computed on the Pimu. As we can see in [its firmware code](http Stretch Body also implements a bump detector using the IMU accelerometers. This detector simply [computes the sum of squares of AX, AY, and AZ](https://github.com/hello-robot/stretch_firmware/blob/master/arduino/hello_pimu/IMU.cpp#L223). This value is then compared to the following threshold to determine if a bump is detected: -```bash ->>$ stretch_params.py | grep pimu | grep bump +```{.bash .shell-prompt} +stretch_params.py | grep pimu | grep bump +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.pimu.config.bump_thresh 20.0 ``` @@ -281,9 +287,10 @@ In addition to AX, AY, and AZ we also see the `single_tap_count` value which rep The following Wacc parameters configure the accelerometer low-pass filter and single-tap settings. See the [ADXL343](https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL343.pdf) datasheet for more details. -```bash ->>$ stretch_params.py | grep wacc -... +```{.bash .shell-prompt} +stretch_params.py | grep wacc +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.wacc.config.accel_LPF 10.0 stretch_body.robot_params.nominal_params param.wacc.config.accel_range_g 4 stretch_body.robot_params.nominal_params param.wacc.config.accel_single_tap_dur 70 @@ -297,8 +304,10 @@ Stretch has four Sharp GP2Y0A51SK0F IR cliff sensors pointed toward the floor. T Relevant parameters for the cliff sensors are: -```bash ->>$ stretch_params.py | grep cliff +```{.bash .shell-prompt} +stretch_params.py | grep cliff +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.pimu.config.cliff_LPF 10.0 stretch_body.robot_params.nominal_params param.pimu.config.cliff_thresh -50 stretch_body.robot_params.nominal_params param.pimu.config.stop_at_cliff 0 @@ -308,8 +317,10 @@ stretch_body.robot_params.nominal_params param.robot_monitor.monitor_base_cliff The sensors are calibrated such that a zero value (as defined by `cliff_zero`) indicates the sensor is at the correct height from the floor surface. A negative value indicates a drop off such as a stair ledge while a positive value indicates an obstacle like a threshold or high pile carpet. You may want to recalibrate this zero based on the surface the robot is on (eg, carpet, tile, etc). To do this: -```bash ->>$REx_cliff_sensor_calibrate.py +```{.bash .shell-prompt} +REx_cliff_sensor_calibrate.py +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- diff --git a/stretch_body/tutorial_safe_coding.md b/stretch_body/tutorial_safe_coding.md index ea5b9f8..91f3b20 100644 --- a/stretch_body/tutorial_safe_coding.md +++ b/stretch_body/tutorial_safe_coding.md @@ -17,8 +17,10 @@ robot: The Runstop deactivates all robot motion. It can be triggered by the physical button on the robot's head. It can also be triggered by internal monitors of the system state. The default configuration of these parameters is: -```bash ->>$ stretch_params.py | grep stop_at +```{.bash .shell-prompt} +stretch_params.py | grep stop_at +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.pimu.config.stop_at_cliff 0 stretch_body.robot_params.nominal_params param.pimu.config.stop_at_high_current 0 stretch_body.robot_params.nominal_params param.pimu.config.stop_at_low_voltage 1 @@ -45,8 +47,10 @@ The [Robot Monitor](https://github.com/hello-robot/stretch_body/blob/master/pyth The default parameters associated with RobotMonitor are: -```bash ->>$ stretch_params.py | grep monitor +```{.bash .shell-prompt} +stretch_params.py | grep monitor +``` +```{.bash .no-copy} ... stretch_body.robot_params.nominal_params param.robot.use_monitor 1 stretch_body.robot_params.nominal_params param.robot_monitor.monitor_base_bump_event 1 @@ -81,9 +85,10 @@ robot: Then run the tool and hit the Runstop button, and then hold it down for 2 seconds: -```bash ->>$ stretch_robot_monitor.py -stretch_robot_monitor.py +```{.bash .shell-prompt} +stretch_robot_monitor.py +``` +```{.bash .no-copy} For use with S T R E T C H (R) RESEARCH EDITION from Hello Robot Inc. --------------------------------------------------------------------- diff --git a/stretch_body/tutorial_splined_trajectories.md b/stretch_body/tutorial_splined_trajectories.md index b6943be..dc54315 100644 --- a/stretch_body/tutorial_splined_trajectories.md +++ b/stretch_body/tutorial_splined_trajectories.md @@ -16,8 +16,10 @@ Splined trajectories are particularly useful when you want to coordinate motion Stretch Body includes [a graphical tool for exploring splined trajectory control](https://github.com/hello-robot/stretch_body/blob/master/tools/bin/stretch_trajectory_jog.py) on the robot: -```bash +```{.bash .shell-prompt} stretch_trajectory_jog.py -h +``` +```{.bash .no-copy} usage: stretch_trajectory_jog.py [-h] [--text] [--preloaded_traj {1,2,3}] (--head_pan | --head_tilt | --wrist_yaw | --gripper | --arm | --lift | --base_translate | --base_rotate | --full_body) Test out splined trajectories on the various joint from a GUI or text menu. @@ -36,7 +38,6 @@ optional arguments: --base_translate Test translational trajectories on diff-drive base --base_rotate Test rotational trajectories on diff-drive base --full_body Test trajectories on all joints at once - ``` The tool GUI allows you to interactively construct a splined trajectory and then execute it on the robot. For example, on the arm: @@ -48,8 +49,8 @@ The tool GUI allows you to interactively construct a splined trajectory and then Finally, you can explore a full-body trajectory using the non-GUI version of the tool: -```bash ->>$ stretch_trajectory_jog.py --full_body +```{.bash .shell-prompt} +stretch_trajectory_jog.py --full_body ``` ## Programming Trajectories @@ -100,14 +101,20 @@ For example, the arm trajectory below has a large excursion outside of the joint ![](./images/bad_trajectory.png) -Often the trajectory waypoints will be generated from a motion planner. It is important for the planner to incorporate the position, velocity, and acceleration constraints of the joint. These can be found by, for example: +Often the trajectory waypoints will be generated from a motion planner. The planner needs to incorporate the position, velocity, and acceleration constraints of the joint. These can be found by, for example: -```bash ->>$ stretch_params.py | grep arm | grep motion | grep trajectory +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep motion | grep trajectory +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.arm.motion.trajectory_max.vel_m 0.4 -stretch_body.robot_params.nominal_params param.arm.motion.trajectory_max.accel_m 0.4 +stretch_body.robot_params.nominal_params param.arm.motion.trajectory_max.accel_m 0.4 +``` ->>$ stretch_params.py | grep arm | grep range_m +```{.bash .shell-prompt} +stretch_params.py | grep arm | grep range_m +``` +```{.bash .no-copy} stretch_user_params.yaml param.arm.range_m [0.0, 0.515] ``` diff --git a/stretch_body/tutorial_tool_change.md b/stretch_body/tutorial_tool_change.md index 1b3d5ed..de02e54 100644 --- a/stretch_body/tutorial_tool_change.md +++ b/stretch_body/tutorial_tool_change.md @@ -14,14 +14,19 @@ Stretch Body supports two tool interfaces by default: The [ToolNone & ToolStretc Stretch is configured to load the ToolStretchGripper interface by default. This tool is loaded according to the `robot.tool` parameter: -```bash ->>$ stretch_params.py | grep robot.tool +```{.bash .shell-prompt} +stretch_params.py | grep robot.tool +``` +```{.bash .no-copy} stretch_body.robot_params.nominal_params param.robot.tool tool_stretch_gripper ``` We can interact with this tool from iPython +```{.bash .shell-prompt} +ipython +``` -```python +```{.python .no-copy} In [1]: import stretch_body.robot as robot In [2]: r=robot.Robot() @@ -77,8 +82,8 @@ The [Stretch Tool Share](https://github.com/hello-robot/stretch_tool_share/) is To use Stretch Tool Share tools, first update your installation: -```console -$ pip install -U hello-robot-stretch-tool-share +```{.bash .shell-prompt} +pip install -U hello-robot-stretch-tool-share ``` As an example, we see on the Tool Share that there is a tool, the [ToolDryEraseToolHolderV1](https://github.com/hello-robot/stretch_tool_share/blob/master/python/stretch_tool_share/dry_erase_holder_v1/tool.py) which [extends the EndOfArm](https://github.com/hello-robot/stretch_tool_share/blob/master/python/stretch_tool_share/usbcam_wrist_v1/tool.py) class. To load this tool interface, modify your `stretch_user_params.yaml` to load the tool as before. We will also need to tell it where to find the tool's [parameter file](https://github.com/hello-robot/stretch_tool_share/blob/master/python/stretch_tool_share/dry_erase_holder_v1/params.py): @@ -116,24 +121,24 @@ Next, we'll see how to change the ROS interface for a tool. Here we will continu Next, ensure ROS is up to date: -```console -$ cd ~/catkin_ws/src/stretch_ros/ -$ git pull +```{.bash .shell-prompt} +cd ~/catkin_ws/src/stretch_ros/ +git pull ``` To access the URDF data for the [ToolDryEraseHolderV1](https://github.com/hello-robot/stretch_tool_share/blob/master/python/stretch_tool_share/dry_erase_holder_v1/tool.py#L3) we'll need to clone the Tool Share repository: -```console -$ cd ~/repos -$ git clone https://github.com/hello-robot/stretch_tool_share +```{.bash .shell-prompt} +cd ~/repos +git clone https://github.com/hello-robot/stretch_tool_share ``` Copy the tool's URDF data into the Stretch ROS repository: -```console -$ cd ~/repos/stretch_tool_share/tool_share/dry_erase_holder_v1 -$ cp stretch_description/urdf/*.xacro ~/catkin_ws/src/stretch_ros/stretch_description/urdf/ -$ cp stretch_description/meshes/*.STL ~/catkin_ws/src/stretch_ros/stretch_description/meshes/ +```{.bash .shell-prompt} +cd ~/repos/stretch_tool_share/tool_share/dry_erase_holder_v1 +cp stretch_description/urdf/*.xacro ~/catkin_ws/src/stretch_ros/stretch_description/urdf/ +cp stretch_description/meshes/*.STL ~/catkin_ws/src/stretch_ros/stretch_description/meshes/ ``` Now we will update the tool Xacro for Stretch. Open the file `~/catkin_ws/src/stretch_ros/stretch_description/urdf/stretch_description.xacro` in an editor. Comment out the current tool Xacro and include the Xacro for the dry-erase holder. @@ -155,16 +160,16 @@ Now we will update the tool Xacro for Stretch. Open the file `~/catkin_ws/src/st Finally, we'll update the calibrated URDF to use this new tool: -```console -$ cd ~/catkin_ws/src/stretch_ros/stretch_description/urdf -$ cp stretch.urdf stretch.urdf.bak -$ rosrun stretch_calibration update_urdf_after_xacro_change.sh +```{.bash .shell-prompt} +cd ~/catkin_ws/src/stretch_ros/stretch_description/urdf +cp stretch.urdf stretch.urdf.bak +rosrun stretch_calibration update_urdf_after_xacro_change.sh ``` Press Ctrl-C when the `rosrun` command terminates and you're ready to visualize the tool in RViz: -```console -$ roslaunch stretch_calibration simple_test_head_calibration.launch +```{.bash .shell-prompt} +roslaunch stretch_calibration simple_test_head_calibration.launch ``` ![](./images/dry_erase_rviz.png)