原創博客:轉載請表明出處:http://www.cnblogs.com/zxouxuewei/ 周學偉
安裝之前:首先確保已經正常制作了ros工作空間並且安裝了rbx1功能包:
cd ~/catkin_ws/src git clone https://github.com/pirobot/rbx1.git cd rbx1 git checkout indigo-devel cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash rospack profile
1.安裝simulator
sudo apt-get install ros-indigo-arbotix-*
注意:一定要刪除任何早期版本的arbotix依賴。
rospack profile
2. 為了確保一切工作,確保roscore運行,然后啟動模擬turtlebot如下
roslaunch rbx1_bringup fake_turtlebot.launch 輸出信息如下: .. logging to /root/.ros/log/c0433730-e414-11e5-8d90-c48e8f5baa47/roslaunch-zxwubuntu-Aspire-V3-572G-3649.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://zxwubuntu-Aspire-V3-572G:56323/ SUMMARY ======== CLEAR PARAMETERS * /arbotix/ PARAMETERS * /arbotix/baud: 115200 * /arbotix/controllers/base_controller/Kd: 12 * /arbotix/controllers/base_controller/Ki: 0 * /arbotix/controllers/base_controller/Ko: 50 * /arbotix/controllers/base_controller/Kp: 12 * /arbotix/controllers/base_controller/accel_limit: 1.0 * /arbotix/controllers/base_controller/base_frame_id: base_footprint * /arbotix/controllers/base_controller/base_width: 0.26 * /arbotix/controllers/base_controller/ticks_meter: 4100 * /arbotix/controllers/base_controller/type: diff_controller * /arbotix/port: /dev/ttyUSB0 * /arbotix/rate: 20 * /arbotix/read_rate: 20 * /arbotix/sim: True * /arbotix/sync_read: True * /arbotix/sync_write: True * /arbotix/write_rate: 20 * /robot_description: <?xml version="1.... * /robot_state_publisher/publish_frequency: 20.0 * /rosdistro: indigo * /rosversion: 1.11.16 * /use_sim_time: False NODES / arbotix (arbotix_python/arbotix_driver) robot_state_publisher (robot_state_publisher/state_publisher) ROS_MASTER_URI=http://localhost:11311 core service [/rosout] found process[arbotix-1]: started with pid [3671] process[robot_state_publisher-2]: started with pid [3672]
3.使用一個模型的pi-機器人,運行命令:
roslaunch rbx1_bringup fake_pi_robot.launch
輸出信息如下:
PARAMETERS * /arbotix/baud: 115200 * /arbotix/controllers/base_controller/Kd: 12 * /arbotix/controllers/base_controller/Ki: 0 * /arbotix/controllers/base_controller/Ko: 50 * /arbotix/controllers/base_controller/Kp: 12 * /arbotix/controllers/base_controller/accel_limit: 1.0 * /arbotix/controllers/base_controller/base_frame_id: base_link * /arbotix/controllers/base_controller/base_width: 0.26 * /arbotix/controllers/base_controller/ticks_meter: 4100 * /arbotix/controllers/base_controller/type: diff_controller * /arbotix/joints/arm_elbow_flex_joint/id: 3 * /arbotix/joints/arm_elbow_flex_joint/invert: True * /arbotix/joints/arm_elbow_flex_joint/max_speed: 100 * /arbotix/joints/arm_elbow_flex_joint/neutral: 512 * /arbotix/joints/arm_shoulder_lift_joint/id: 2 * /arbotix/joints/arm_shoulder_lift_joint/invert: True * /arbotix/joints/arm_shoulder_lift_joint/max_speed: 100 * /arbotix/joints/arm_shoulder_lift_joint/neutral: 512 * /arbotix/joints/arm_shoulder_pan_joint/id: 1 * /arbotix/joints/arm_shoulder_pan_joint/invert: False * /arbotix/joints/arm_shoulder_pan_joint/max_angle: 145 * /arbotix/joints/arm_shoulder_pan_joint/max_speed: 100 * /arbotix/joints/arm_shoulder_pan_joint/min_angle: -145 * /arbotix/joints/arm_shoulder_pan_joint/neutral: 512 * /arbotix/joints/arm_wrist_flex_joint/id: 4 * /arbotix/joints/arm_wrist_flex_joint/invert: True * /arbotix/joints/arm_wrist_flex_joint/max_angle: 90 * /arbotix/joints/arm_wrist_flex_joint/max_speed: 100 * /arbotix/joints/arm_wrist_flex_joint/min_angle: -90 * /arbotix/joints/arm_wrist_flex_joint/neutral: 512 * /arbotix/joints/gripper_joint/id: 5 * /arbotix/joints/gripper_joint/invert: False * /arbotix/joints/gripper_joint/max_angle: 25 * /arbotix/joints/gripper_joint/max_speed: 100 * /arbotix/joints/gripper_joint/min_angle: -20 * /arbotix/joints/gripper_joint/neutral: 512 * /arbotix/joints/head_pan_joint/id: 6 * /arbotix/joints/head_pan_joint/invert: False * /arbotix/joints/head_pan_joint/max_angle: 145 * /arbotix/joints/head_pan_joint/max_speed: 100 * /arbotix/joints/head_pan_joint/min_angle: -145 * /arbotix/joints/head_pan_joint/neutral: 512 * /arbotix/joints/head_tilt_joint/id: 7 * /arbotix/joints/head_tilt_joint/invert: False * /arbotix/joints/head_tilt_joint/max_angle: 90 * /arbotix/joints/head_tilt_joint/max_speed: 100 * /arbotix/joints/head_tilt_joint/min_angle: -90 * /arbotix/joints/head_tilt_joint/neutral: 512 * /arbotix/port: /dev/ttyUSB0 * /arbotix/rate: 20 * /arbotix/read_rate: 20 * /arbotix/sim: True * /arbotix/sync_read: True * /arbotix/sync_write: True * /arbotix/write_rate: 20 * /robot_description: <?xml version="1.... * /robot_state_publisher/publish_frequency: 20.0 * /rosdistro: indigo * /rosversion: 1.11.16 * /use_sim_time: False
4.接下來,把rviz所以我們可以觀察模擬機器人在行動:
rosrun rviz rviz -d `rospack find rbx1_nav`/sim.rviz

5.發布消息,使機器人移動。要測試模擬,打開另一個終端窗口,並運行以下要使模擬機器人在逆時針方向移動:
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.5}}'

6.需要停止機器人 ,在同一個終端窗口式Ctrl-C,或者發布空Twist message:
rostopic pub -1 /cmd_vel geometry_msgs/Twist '{}'
