Uncheck item Don't allow detections if distance smaller than then close that dialog again.
Edit proximity sensor's name. We enter bubbleRob_sensingNose and press enter. Select bubbleRob_sensingNose, then control-select bubbleRob, then click [Menu bar --> Edit --> Make last selected object parent].
This is what we now have:
Create a new scene with [Menu bar --> File --> New scene].
Enable the motor, and check item Lock motor when target velocity is zero.
Repeat the same procedure for the right motor and rename it to bubbleRob_rightMotor.
Attach the left wheel to the left motor, the right wheel to the right motor, then attach the two motors to bubbleRob.
This is what we have:
In a new scene we and add a pure primitive sphere with diameter 0.05 and make the sphere Collidable,Measurable,Renderable and Detectable (if not already enabled), then rename it to bubbleRob_slider.
Rename it to bubbleRob_connection and shift it up by 0.05.
Attach the slider to the force sensor, then copy both objects, switch back to scene 1 and paste them.
Shift the force sensor by -0.07 along the absolute X-axis, then attach it to the robot body.
If we run the simulation now, we can notice that the slider is slightly moving in relation to the robot body.
In the shape dynamics properties, for bubbleRob_slider we set the local respondable mask to 00001111, and for bubbleRob, we set the local respondable mask to 11110000.
If we run the simulation again, we can notice that both objects do not interfere anymore.
This is what we now have:
Select the two wheels and the slider, and in the shape dynamics dialog we click three times M=M*2 (for selection).
The effect is that all selected shapes will have their masses multiplied by 8.
Do the same with the inertias of the 3 selected shapes.
Run the simulation again.
Set the Target velocity to 50 for both motors.
We run the simulation: BubbleRob now moves forward and eventually falls off the floor.
Reset the Target velocity item to zero for both motors.
Click [Menu bar --> Tools --> Collections] to open the collection dialog.
In the collection dialog, we click Add new collection.
While the new collection item is selected in the list, select bubbleRob in the scene hierarchy, and then click Add in the collection dialog.
To edit the collection name, we double-click it, and rename it to bubbleRob_collection.
Open the distance dialog with [Menu bar --> Tools --> Calculation module properties].
In the distance dialog, we click Add new distance object and select a distance pair: [collection] bubbleRob_collection - all other measurable objects in the scene.
Rename the distance object to bubbleRob_distance with a double-click in its name.
Click [Menu bar --> Add --> Graph] and rename it to bubbleRob_graph.
Attach the graph to bubbleRob, and set the graph's absolute coordinates to (0,0,0.005).
Open the graph properties dialog by double-clicking its icon in the scene hierarchy.
Uncheck Display XYZ-planes, then click Add new data stream to record and select Object: absolute x-position for the Data stream type, and bubbleRob_graph for the Object / item to record.
Also want to record the y and z positions: we add those data streams in a similar way as above.
Click Add new data stream to record and select Distance: segment length for the Data stream type, and bubbleRob_distance for the Object / item to record.
In the Data stream recording list, we now rename Data to bubbleRob_x_pos, Data0 to bubbleRob_y_pos, Data1 to bubbleRob_z_pos, and Data2 to bubbleRob_obstacle_dist.
Select bubbleRob_x_pos in the Data Stream recording list and in the Time graph properties section, uncheck Visible. We do the same for bubbleRob_y_pos and bubbleRob_z_pos.
In the dialog that pops open, we select bubbleRob_x_pos for the X-value item, bubbleRob_y_pos for the Y-value item and bubbleRob_z_pos for the Z-value item.
Rename the newly added curve from Curve to bubbleRob_path.
Check the Relative to worlditem and setCurve width to 4.
Set one motor target velocity to 50, run the simulation, and will see BubbleRob's trajectory displayed in the scene.
Stop the simulation and reset the motor target velocity to zero.
Add a pure primitive cylinder with following dimensions: (0.1, 0.1, 0.2).
The cylinder is still selected, we click the object translation toolbar button.
Drag any point in the scene: the cylinder will follow the movement while always being constrained to Keep the same Z-coordinate.
Copy and paste the cylinder a few times, and move them to positions around BubbleRob.
Set a target velocity of 50 for the left motor and run the simulation: the graph view now displays the distance to the closest obstacle and the distance segment is visible in the scene too.
Stop the simulation and reset the target velocity to zero.
Check items Object is model base and Object/model can transfer or accept DNA in the object common properties.
Select the two joints, the proximity sensor and the graph, then enable item Igonred by model bounding box and click Apply to selection.
Disable camera visibility layer 2, and enable camera visibility layer 10 for the two joints and the force sensor: this effectively hides the two joints and the force sensor
Select the vision sensor, the two wheels, the slider, and the graph, then enable item Select base of model instead.
Select the filter component Edge detection on work image and click Add filter.
Position the newly added filter in second position (one position up, using the up button).
Double-click the newly added filter component and adjust its Threshold item to 0.2, then click OK.
Added floating view, right-click [Popup menu --> View --> Associate view with selected vision sensor](make sure the vision sensor is selected during that process).
Start the simulation, then stop it again.
Select bubbleRob and click [Menu bar --> Add --> Associated child script --> Non threaded].
Double-click the little script icon that appeared next to bubbleRob's name in the scene hierarchy.
Copy and paste following code into the script editor, then close it:
Run the simulation. BubbleRob now moves forward while trying to avoid obstacles.