iRobotEducation / create3_sim

ROS 2 Simulation for the iRobot® Create® 3 Educational Robot
BSD 3-Clause "New" or "Revised" License
110 stars 56 forks source link

Make ir_opcode behavior more similar to robot #93

Closed justinIRBT closed 3 years ago

justinIRBT commented 3 years ago

Is your feature request related to a problem? Please describe. The behavior of the ir opcodes is more of the robot's beacon being a receiver of the dock emissions as opposed to the intersection of 2 projections.

Describe the solution you'd like We think this can be accomplished by making the robot's omni circle be very small, then when it intersects the dock's projection, we can look at the angle between where the dock is facing and the receiver is facing to see if its a valid observation.

Normally the omni sensor would see 360, but because of the create faceplate, we could want to cap the angle to +/- 110. For the directional sensor, it would be +/- 45. So in summary, if you make the circle off the robot's beacon much smaller (like 1cm), then if it intersects with the dock forcefield, check the angle between the two lines (line projected in direction robot is facing and the line from robot receiver to dock emitter) and see if its absolute value < 110. Similarly, if the smaller robot circle intersects with the dock directional emitter, check the angle between the same 2 lines and see if its absolute value < 45. Hopefully its a small change from the code you have, reusing the circle intersection logic, just with a smaller robot circle. Sorry we didn't catch this during the review before testing.

Also can we use 0.61 m for halo radius and 1.22 m for buoys max range

justinIRBT commented 3 years ago

I was able to make some progress on this just by modifying create3.urdf.xacro with the following:

<xacro:property name="ir_omni_fov_rad" value="${220.0/360.0*2*pi}"/>
  <xacro:property name="ir_front_facing_fov_rad" value="${pi/180}"/>
  <xacro:ir_opcode_receivers sensor_0_range="0.01" sensor_0_fov="${ir_omni_fov_rad}"
    sensor_1_range="0.01" sensor_1_fov="${ir_front_facing_fov_rad}" visualize="true" >
    <origin xyz="0.153 0 0.035"/>
  </xacro:ir_opcode_receivers>

This seems to give me the behavior I want for the omni beacon, still collecting data from the robot for comparison