[Documentation] [TitleIndex] [WordIndex

Setup

Check out the dance_demo stack.

svn co https://code.ros.org/svn/wg-ros-pkg/branches/trunk_cturtle/stacks/dance_demo/

Add it to your ROS_PACKAGE_PATH:

cd dance_demo
export ROS_PACKAGE_PATH=`pwd`:$ROS_PACKAGE_PATH

Make sure that the joint_trajectory_replay and package is built.

rosmake joint_trajectory_replay

Recording

There are various launch files, depending on what you want to record:

head_record.launch

head pan and tilt

joint_record.launch

head, tilt stage, left and right arms

left_record.launch

left arm

right_record.launch

right arm

spine_record.launch

spine motion

tilt_record.launch

tilt stage

To record, just launch the launch file. Hit CTRL+C when you are done. The bag name will be autogenerated by rosbag.

You can easily create other combinations by rolling your own launch file.

Replaying

Replaying uses triggers to start the playback. You can replay multiple bags at once and trigger them from the same trigger.

Start Joint Replay Nodes

You can do this step with as many bags as you like (different shell for each bag). Each joint should only be driven by one bag or havoc will ensue.

To play bag foo.bag:

BAG=foo.bag roslaunch joint_replay.launch

Trigger Replay

Once all the joint_replay commands are ready, trigger the replay:

rosrun trigger_msgs trigger.py _delay:=2.7

In this example, replay will start 2.7 seconds after the trigger message is sent. In a multi-computer setting, clock synchronization is assumed.

Configuring replay

Some parameters can be adjusted when replaying a bag:

time_step

how often to send command messages to the joints 0.05 is nice

cut

how many seconds to cut from the start of the bag

start_delay

adds an additional delay after the trigger time

ready_by

how fast the robot needs to get into its starting position

The ready_by parameter deserves more attention. When the replay is triggered, the joints will not be in the position at the start of the bag. joint_replay.py will generate a smooth trajectory from the current position to the bag start position. This smooth motion will start as soon as the trigger message is received (time t0). If the trigger is set to occur at time t1 (time when trigger.py sent the message plus the delay parameter). The smooth motion will end at time:

t0 * ready_by + t1 * (1 - ready_by)

For example, for ready_by = 0, the motion will be instantaneous (not recommended), for ready_by = 1, the motion will end exactly when the bag replay is due to start, and for ready_by = 0.5, the motion will end half way between t0 and t1.


2024-11-23 14:43