This actuator reads the coordinates of a destination point, and moves the robot towards the given point, with the robot restricted to moving only forward, turning around its Z axis, and possibly going up and down. This controller is meant to be used mainly by non-holonomic robots.
While a robot is moving towards a given waypoint, a property of the Robot will be changed in indicate the status of the robot. The movement_status property will take one of these values: Stop, Transit or Arrived.
The movement speed of the robot is internally adjusted to the Blender time measure, following the formula: blender_speed = given_speed * tics, where tics is the number of times the code gets executed per second. The default value in Blender is tics = 60.
This actuator also implements a simple obstacle avoidance mechanism. The blend file contains the Motion_Controller empty, as well as two additional Empty objects: Radar.L and Radar.R. These detect nearby objects to the left or right of the robot, and will instruct the robot to turn in the opposite direction of the obstacle. If the radar objects are not present, the controller will not have any obstacle avoidance, and the robot can get blocked by any object between it and the target.
For objects to be detectable by the radars, they must have the following settings in the Physics Properties panel:
This will work even for Static objects
You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).
if true (default), will activate obstacle avoidance if the radars are present
if false (default), the robot is only controlled on ‘X’ and heading; if true, ‘Z’ is also controlled (for aerial or submarine robots)
Tolerance in radian regarding the final heading of the robot
movement speed for the robot, given in m/s
name of a blender object in the scene. When specified, this object will be placed at the coordinates given to the actuator, to indicate the expected destination of the robot
List of property names. If the object detected by the radars has any of these properties defined, it will be ignored by the obstacle avoidance, and will not make the robot change its trajectory. Useful when trying to move close to an object of a certain kind
Kind of control, can be one of [‘Velocity’, ‘Position’]
This actuator reads these datafields at each simulation step:
X coordinate of the destination, in world frame, in meter
Y coordinate of the destination, in world frame, in meter
Z coordinate of the destination, in world frame, in meter
Tolerance, in meter, to consider the destination as reached.
If the property ‘Speed’ is set, use this speed as initial value.
Set a new waypoint and returns.
The robot will try to go to this position, but the service caller has no mean to know when the destination is reached or if it failed.
In most cases, the asynchronous service ‘goto’ should be prefered.
Returns always True (if the robot is already moving, the previous target is replaced by the new one) except if the destination is already reached. In this case, returns False.
Returns the properties of a component.
a dictionary of the current component’s properties
This method can be used to give a one time instruction to the actuator. When the robot reaches the destination, it will send a reply, indicating that the new status of the robot is “Stop”.
This method will instruct the robot to set its speed to 0.0, and reply immediately. If a goto request is ongoing, it will remain “pending”, as the current destination is not changed.
Returns the configurations of a component (parsed from the properties).
a dictionary of the current component’s configurations
Restores the speed to the same value as before the last call to the stop service. The robot will continue to the last waypoint specified.
Ask the actuator to send a message indicating the current movement status of the parent robot. There are three possible states: Transit, Arrived and Stop.
The following examples show how to use this component in a Builder script:
from morse.builder import * robot = ATRV() # creates a new instance of the actuator waypoint = Waypoint() # place your component at the correct location waypoint.translate(<x>, <y>, <z>) waypoint.rotate(<rx>, <ry>, <rz>) robot.append(waypoint) # define one or several communication interface, like 'socket' waypoint.add_interface(<interface>) env = Environment('empty')