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
Setupping sensors Setupping sensor
Creating own levels Creating own levels
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/Commands std_msgs/String "SpawnObjects C:/Agrarsense/Examples/ExampleJsonFiles/forwarder.json" --once
# ROS2
ros2 topic pub /Agrarsense/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:
```json
{
"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:
```json
{
"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

Check Setup Sensors on how to setup the sensors.

Driving the Forwarder in map

Inputs for driving forward is WASD

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 through ROS

  • Continuous message to AGRARSENSE/Forwarder/Movement

Breakdown:

Angular.y = Throttle/Brake (value = between -1 and 1) Linear.y = Steer vehicle left, right (Value = between -1 and 1)

Example of driving forward:

Rostopic pub /AGRARSENSE/Forwarder/Movement geometry_msgs/Twist [0,1,0] [0,0,0]

Example of driving backwards / breaking:

Rostopic pub /AGRARSENSE/Forwarder/Movement geometry_msgs/Twist [0,-1,0] [0,0,0]

Example of driving forward and turning left:

Rostopic pub /AGRARSENSE/Forwarder/Movement geometry_msgs/Twist [0,1,0] [0,-1,0] -r 30

Steering vehicle command must be sent continuously in order to keep streeting

Controlling Forwarder arm through ROS

  • Continuous message to AGRARSENSE/Forwarder/BoomMovement (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/Forwarder/BoomMovement 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.

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/Commands std_msgs/String "SpawnObjects C:/Agrarsense/Examples/ExampleJsonFiles/drone_roaming_rgbcamera.json" --once
# ROS2
ros2 topic pub /Agrarsense/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/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/Commands std_msgs/String "MoveDroneTo drone 300,200,5000" --once
# ROS2
rostopic pub /Agrarsense/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}