Agrarsense
Using AGRARSENSE vehicles

Documentation

Topic Link
Getting Started Getting Started
Using the Simulator Using the Simulator
Using Vehicles Using Vehicles
Using Walkers Using Walkers
Sensors Sensors
Creating own maps Creating own maps
Building from source on Linux Building on Linux
Building from source on Windows Building on Windows
Installing on Linux Installing on Linux
Installing on Windows Installing on Windows

Spawning vehicles through User Interface

  1. Open Asset Placement tool
  2. Select vehicle from the Vehicles-tab
  3. Select position you want vehicle to be spawned

Spawning Vehicles through ROS

To spawn Forwarder with or without sensors, you can utilize ROS Commands topic SpawnObjects {full_path.json} ROS Command.

# ROS1
rostopic pub /agrarsense/in/commands std_msgs/String "SpawnObjects C:/Agrarsense/Examples/ExampleJsonFiles/forwarder.json" --once
# ROS2
ros2 topic pub /agrarsense/in/commands std_msgs/String "data: SpawnObjects D:/Work/Agrarsense/Agrarsense/Examples/ExampleJsonFiles/forwarder.json" --once

With this command, the simulator loads and parses the .json file and if successfull, vehicle is spawned with sensor(s) if defined. Example .json file structure below. To ensure your JSON file is properly structured for Forwarder spawning, you can refer to our example JSON files.

Forwarder:

{
"objects":
[
{
"type": "vehicle",
"model": "Forwarder",
"id": "forwarder",
"teleportSpectator": "false",
"followObject": "false",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 200.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
]
}

Harvester:

{
"objects":
[
{
"type": "vehicle",
"model": "Harvester",
"id": "Harvester",
"teleportSpectator": "false",
"followObject": "false",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 200.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
]
}

Drone:

{
"objects":
[
{
"type": "vehicle",
"model": "Drone",
"id": "Drone",
"teleportSpectator": "false",
"followObject": "false",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 200.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
]
}

Adding Sensors to Vehicles

See Sensors

Forwarder & Harvester

Driving Forwarder & Harvester manually

Spawn vehicle either through user interface or ROS. Then right click vehicle and select 'Manual Control' from the context menu. This will attach Spectator camera to the vehicle and allows you drive the vehicle manually.

Image

Inputs for driving forward is WASD

W = Forward
S = Backward / break

A = Turn left
D = Turn right

Inputs for the boom is assigned to the numpad and letter keys:

Numpad 8 / I = whole boom up
Numpad 2 / K = whole boom down

Numpad / T = reaching boom up
Numpad / G = reaching boom down

Numpad 4 / J = whole boom left
numpad 6 / L = whole boom right

Numpad + / U = Extension boom in
numpad - / O = Extension boom out

Driving the Forwarder & Harvester through ROS

  • Send message to Agrarsense/in/Vehicles/VEHICLE_ID/Movement to start moving the vehicle.

To control the vehicle, you can send movement commands to the topic Agrarsense/Vehicles/VEHICLE_ID/Movement.

The vehicle keeps following the last command until a new one is sent.

Command Breakdown:

[0, Angular.y, 0] [0, Linear.y, 0]
  • Angular.y controls Throttle/Brake, with a value range between -1.0 and 1.0:
    • -1.0 drives the vehicle backward at the highest acceleration.
    • 1.0 drives the vehicle forward at the highest acceleration.
  • Linear.y controls the steering angle, with a value range between -45 and 45 degrees.

Examples:

  1. To drive the vehicle forward at the highest acceleration and straight:
    [0, 1.0, 0] [0, 0, 0]
  2. To drive the vehicle backwards at the highest acceleration and straight:
    [0, -1.0, 0] [0, 0, 0]
  3. To drive the vehicle forward at moderate acceleration and turn right:
    [0, 0.5, 0] [0, 45, 0]
  4. To drive the vehicle forward at moderate acceleration and turn left:
    [0, 0.5, 0] [0, -45, 0]
  5. Stop movement
    [0, 0.0, 0] [0, 0, 0]
# VEHICLE_ID can be setup manually when spawning objects through JSON
# If ID is not setup then ID will be 'forwarder' for first forwarder then 'forwarder1', 'forwarder2' and so on.
# Same applies to other vehicles: 'harvester', 'harvester1', 'harvester2' and drone, drone1, drone2 and so on.
rostopic pub /agrarsense/in/vehicles/VEHICLE_ID/movement geometry_msgs/Twist [0,1,0] [0,0,0]
rostopic pub /agrarsense/in/vehicles/VEHICLE_ID/movement geometry_msgs/Twist [0,0.5,0] [0,0,0]
# Driving forward:
rostopic pub /agrarsense/in/vehicles/forwarder/movement geometry_msgs/Twist [0,1,0] [0,0,0]
# Stationary / no input:
rostopic pub /agrarsense/in/vehicles/forwarder/movement geometry_msgs/Twist [0,0,0] [0,0,0]
# Driving backwards / breaking:
rostopic pub /agrarsense/in/vehicles/forwarder/movement geometry_msgs/Twist [0,-1,0] [0,0,0]
# Example of driving forward and turning left:
# Steering vehicle command must be sent continuously in order to keep steering.
rostopic pub /agrarsense/in/vehicles/forwarder/movement geometry_msgs/Twist [0,1,0] [0,-1,0] -r 30

Controlling Forwarder & Harvester arm through ROS

  • Continuous message to agrarsense/in/vehicles/VEHICLE_ID/boom_movement (Twist message)
  • Boom movement is divided in 2 sections, Angular and Linear
  • Angular is for the main boom
  • Linear is for the grapple & Extended boom

    Breakdown:

    Angular.x = Outerboom movement up, down (value = degrees) Angular.y = Innerboom movement up, down (value = degrees) Angular.z = Whole boom rotation left, right (value = degrees)

    Linear.x = Boom extension in, out Linear.y = Grapple open, close (value = degrees) Linear.z = grapple rotation left, right (value = degrees)

    Example of rotating the whole boom:

rostopic pub /agrarsense/vehicles/forwarder/boom_movement geometry_msgs/Twist [0,0,1] [0,0,0] -r 30

This has to be continuous movement in order to rotate the boom 1 degrees in every tick.

Drone

Flying Drone through ROS

  • Continuous message to agrarsense/in/vehicles/VEHICLE_ID/movement (Twist message)
  • Drone movement is divided in 2 sections, Angular and Linear
  • Angular is for the side to side and forward and backward movements
  • Linear is for the ruddder and up / down movements

    Breakdown:

    Angular.x = Drone left / right tilt (value = -1 to 1) Angular.y = Drone forwards / backwards (value = -1 to 1) Angular.z = NOT USED

    Linear.x = NOT USED Linear.y = Drone rudder left / right (value = -1 to 1) Linear.z = Drone up / down (value = -1 to 1)

    Example of moving drone through ROS:

rostopic pub /agrarsense/in/vehicles/drone/movement geometry_msgs/Twist [0,0,0] [0,1,0] -r 30

This has to be continuous movement in order to move the drone in every tick.

Spawning Drone through User Interface

  1. Open Asset Placement tool
  2. Select Drone from the Vehicles-tab
  3. Select position you want Drone to be spawned
  4. Drone is now spawned and it will hover until it gets controls commands through ROS

Spawning Drone through ROS

To spawn Drone with or without sensors, you can utilize ROS Commands topic SpawnObjects {full_path.json} ROS Command.

# For example on Windows
# ROS1
rostopic pub /agrarsense/in/commands std_msgs/String "SpawnObjects C:/Agrarsense/Examples/ExampleJsonFiles/drone_roaming_rgbcamera.json" --once
# ROS2
ros2 topic pub /agrarsense/in/commands std_msgs/String "data: SpawnObjects D:/Work/Agrarsense/Agrarsense/Examples/ExampleJsonFiles/drone_roaming_rgbcamera.json" --once

With this command, the simulator loads and parses the .json file and if successfull, vehicle is spawned with sensor(s) if defined. Example .json file structure below. To ensure your JSON file is properly structured for Drone spawning, you can refer to our example JSON files.

{
"objects":
[
{
"type": "vehicle",
"model": "Drone",
"id": "drone",
"teleportSpectator": "false",
"followObject": "false",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 200.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
]
}

Adding Sensors to Drone

You can add Sensors to Drone via user interface, which you can then save into preset (shows in garage preset) or export into .json file so it can be re-used easily without needing to setup the Drone each time.

1) Spawn Drone via user interface or via ROS.

2) Right click the Drone and context menu should appear.

3) Click "Move to Garage"

4) Setup sensors in "Garage". Check Setup Sensors on how to setup the sensors.

5) To export Drone and its sensor(s) click Export.

.json file will be exported to SIMULATION_ROOT/Data/ExportedJsonFiles/ and it will look something like below.

{
"objects":
[
{
"type": "Vehicle",
"model": "Drone",
"id": "drone",
"teleportSpectator": "false",
"followObject": "false",
"parameters":
{
"droneAction": "Roaming",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 2000.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
},
"sensors": [
{
"type": "sensor",
"model": "RGBCamera",
"name": "rgbcamera",
"spawnPoint":
{
"x": 4.8027869806610397,
"y": -0.2371900285652373,
"z": 18.666467517919955,
"roll": -0,
"pitch": 0,
"yaw": 0
},
"parameters":
{
"postProcessingEffects": true,
"enable16BitFormat": true,
"fOV": 90,
"targetGamma": 1,
"shutterSpeed": 60,
"iSO": 100,
"width": 1280,
"height": 720,
"focalDistance": 0,
"depthBlurAmount": 1,
"depthBlurRadius": 0,
"dofMinFStop": 1.2,
"dofBladeCount": 5,
"filmSlope": 0.88,
"filmToe": 0.55,
"filmShoulder": 0.25,
"filmBlackClip": 0,
"filmWhiteClip": 0.04,
"exposureMinBrightness": -10,
"exposureMaxBrightness": 20,
"exposureSpeedUp": 3,
"exposureSpeedDown": 1,
"motionBlurIntensity": 0.5,
"motionBlurMax": 5,
"motionBlurMinObjSize": 0,
"lensFlareIntensity": 1,
"bloomIntensity": 0,
"whiteTemp": 6500,
"whiteTint": 0,
"chromAberrIntensity": 0,
"chromAberrOffset": 0,
"aperture": 4,
"saveImageToDisk": false,
"sendDataToROS": true,
"targetFrameRate": 0,
"usePhysicLensDistortionEffect": true,
"useIceLensEffect": false,
"iceLensEffectStrength": 0.3,
"iceLensEffectAngle": 1.0
}
}
]
}
]
}

Spawning Roaming Drone

Example .json structure below.

The Drone will roam randomly around the map until it is destroyed, or it receives controls commands through ROS.

{
"objects":
[
{
"type": "Vehicle",
"model": "Drone",
"id": "drone",
"teleportSpectator": "false",
"followObject": "false",
"parameters":
{
"droneAction": "Roaming",
"spawnPoint":
{
"x": 0.0,
"y": 0.0,
"z": 200.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
}
]
}

Spawning Follow Path Drone

Example .json structure below.

Drone will follow the given path until it is gets to the end, and if the droneEndAction is "Destroy" it will destroy itself.

If the drone receives any controls commands through ROS while following the given path, drone will stop following the given path.

{
"objects":
[
{
"type": "Vehicle",
"model": "Drone",
"id": "drone",
"teleportSpectator": "false",
"followObject": "false",
"parameters":
{
"dromeAction": "FollowPath",
"droneEndAction": "RepeatFromBeginning",
"points":
{
"point0":
{
"x": 0.0,
"y": 0.0,
"z": 2000.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
},
"point1":
{
"x": -3360.0,
"y": 7750.0,
"z": 1430,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
},
"point2":
{
"x": -3350.0,
"y": 7100.0,
"z": 1430.0,
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0
}
}
}
}
]
}

Controlling the Drone through ROS

Controlling the drone when manual flightmode happens in /agrarsense/vehicles/BP_Drone_C_0/Movement Topic Message type is geometry_msgs/Twist:

  • Vector3 linear
  • Vector3 angular

Linear controls the Roll, Angular controls the Pitch and Yaw

(Example moving script in Agrarsense\Examples\ROS1\drone_movement.py)

To move Drone another location, you can utilize ROS Commands topic MoveDroneTo drone {x,y,z} ROS Command.

# For example on Windows
# ROS1
rostopic pub /agrarsense/in/commands std_msgs/String "MoveDroneTo drone 300,200,5000" --once
# ROS2
rostopic pub /agrarsense/in/commands std_msgs/String "data: MoveDroneTo drone 300,200,5000" --once

It will automatically override roaming mode to head to this position.

Other Drone ROS commands

id = ID of Actor
X,Y,Z = Destination

MoveDroneToAndDestroy {ID} {x,y,z}
StopDrone {ID}
ResumeDrone {ID}
TeleportById {ID} {x,y,z}