This chapter explains how to run basic simulations such as utilization of using a JVRC-1 model as an example.
You can use preconfigured project prepared for this tutorial.
$ roslaunch choreonoid_ros jvrc-1-rviz.launch
You should see the JVRC O1 task loaded on Choreonoid with rviz visualization.
Note
Preconfigured project has been created in the Foward dynamics mode.
List available topics:
$ rostopic list
Print input of force sensor:
$ rostopic echo /JVRC_1/lfsensor
Display camera input (using image-view package):
$ sudo apt-get install ros-$ROS_DISTRO-image-view
$ rosrun image_view image_view image:=/JVRC_1/rcamera/image_raw
Pause the simulation:
$ rosservice call /World/pause_physics
Continue the paused simulation:
$ rosservice call /World/unpause_physics
Following example (test-torque-control-jvrc1.py) sends each trajectory commands to any joint of JVRC-1 robot.
.. literalinclude:: test-torque-control-jvrc1.py :language: python
The script contains under directory of ~/catkin_ws/install/share/choreonoid_plugins/test.
The script you can run in the following procedure.
- You can use preconfigured project prepared for this tutorial.
$ roslaunch choreonoid_ros jvrc-1-rviz.launch
- Open a new terminal.
- For example, if you want to rotate 45 degrees for the neck. Run the following command.
$ rosrun choreonoid_plugins test-torque-control-jvrc1.py NECK_Y 45.0
Or you can prepare project of your own.
To prepare your own project:
- Create World item and create Body item by opening the robot model data.
- Configure AISTSimulator item to use Foward dynamics mode.
- (Optional) Create and place ViewSimulator item under the AISTSimulator you want to get image input.
- Create and place BodyRos item under the robot you want to control.
- Create and place BodyRosTorqueController item under the robot you want to control.
- To prevent the robot from falling, add a model of the ground. Please details see 'Add a model of the floor'.
- Create and place WorldRos item under the world you want to control.
Item view should be structured as follows after the above configuration.
If the roscore has not been started, start the roscore in a different terminnal.
$ roscore
Finally, click "start simulation" button to enable the ROS functions.