personalrobotics / ada_ros2

ROS2 Hardware Interface and Description for the ADA Robot
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Add sim to `ada_imu` #16

Closed amalnanavati closed 1 year ago

amalnanavati commented 1 year ago

Description

In service of #14, this PR does the following:

  1. Add a sim argument to ada_imu.launch.py and a corresponding parameter to imu_jointstate_publisher.py. This argument should be able to take on values of either mock or real.
  2. In imu_jointstate_publisher.py, if sim!="real", then don't load the serial port and always assume the imu_angle is 0. Also, if there is any error reading from the serial port, asusme the imu angle is always 0.
  3. In ada_moveit demo.launch.py, include ada_imu.launch.py with the sim argument set to the same value that is passed in to the moveit launch file.

Testing

  1. Run ros2 launch ada_moveit demo.launch.py sim:=mock
    • [x] Run ros2 run tf2_tools view_frames and verify that the output is a single connected TF tree.
  2. Run ros2 launch ada_moveit demo.launch.py with the IMU unplugged.
    • [x] Run ros2 run tf2_tools view_frames and verify that it logs an error but world->root is still in the same TF tree as the robot.
  3. Run ros2 launch ada_moveit demo.launch.py with the IMU plugged in.
    • [x] Run ros2 run tf2_tools view_frames and verify that the output is a single connected TF tree.
    • [x] Tilt the wheelchair and verify that the robot in RVIZ rotates accordingly.
    • [x] Unplug the IMU and verify that the node doesn't crash, but rather logs an error and continues publishing 0 (verify this by ensuring there is still one connected TF tree)

Before Merging