The 3D Unity-based Husky Robotics simulator.
To create a new release from main
, push create and push a new tag, replacing <major>
, <minor>
, and <patch>
with the appropriate values, as per semantic versioning.
git tag v<major>.<minor>.<patch>
git push origin --tags
This simulator creates a WebSocket client to connect directly to the rover WebSocket server at the URL ws://localhost:3001/simulator
. The simulator will automatically connect to the rover server and reconnect as needed, providing a visual indication of the connection status. The simulator and the rover server communicate with each other by sending JSON objects termed messages over the WebSocket connection. Through these messages, the rover server can request that the simulator perform certain actions, such as set a a motor's power. Additionally, the simulator provides the rover server with data such as camera streams through these messages.
- Download the latest release for your operating system.
- Give the executable included with your download permission to run as an executable.
- Run the executable.
- Start the rover server. Optionally, start Mission Control if you would like to teleoperate the rover yourself. The simulator will automatically connect to the rover server and begin sending and receiving messages.
The simulator is able to simulate the motors with the following names:
- frontLeftWheel
- frontRightWheel
- rearLeftWheel
- rearRightWheel
- armBase
- shoulder
- elbow
- forearm
- wristDiffLeft
- wristDiffRight
- hand
The simulator is able to simulate the cameras with the following names:
- mast
- hand
- wrist
The simulator is also able to simulate the following hardware devices:
- GPS sensor
- IMU
The JSON objects sent between the simulator and the rover server are termed messages. Each message has a type property and a number of additional parameters depending on the type. Each type is prefaced with "sim" to avoid confusion with messages pertaining to Mission Control. The usage of each type of message is detailed below.
Sent from the rover server to instruct the simulator to make a motor run with a specified power. The motor will only be powered for one second upon receiving the request. After one second, the power will be zeroed to simulate watchdog timers. Thus, to keep a motor powered continuously, the message will need to be resent periodically.
{
type: "simMotorPowerRequest",
motor: string,
power: number
}
motor
- the name of the motorpower
- the requested power in [-1, 1]
Sent from the rover server to instruct the simulator to make a motor run to a specified position.
{
type: "simMotorPositionRequest",
motor: string,
position: number
}
motor
- the name of the motorposition
- the requested position in millidegrees
Sent from the simulator to inform the rover server of a motor's status.
{
type: "simMotorStatusReport",
motor: string,
power: number | null,
position: number | null
}
motor
- the name of the motorpower
- the current power of the motor in [-1, 1], ornull
if unavailableposition
- the current integer position of the motor in millidegrees, ornull
if unavailable
Sent from the simulator to inform the rover server that a motor has triggered its limit switch.
{
type: "simLimitSwitchAlert",
motor: string,
limit: "minimum" | "maximum"
}
motor
- the name of the motor
Sent from the rover server to instruct the simulator to begin providing a camera stream.
{
type: "simCameraStreamOpenRequest",
camera: string,
fps: number,
width: number,
height: number,
intrinsicParameters: number[9] | null
}
camera
- the name of the camera:mast|hand|wrist
fps
- the frames per second of the streamwidth
- the width of the stream in pixelsheight
- the height of the stream in pixelsintrinsicParameters
- the intrinsic parameters to be used by the camera, ornull
if none should be specified
Sent from the rover server to instruct the simulator to stop providing a camera stream.
{
type: "simCameraStreamCloseRequest",
camera: string
}
camera
- the name of the camera:mast|hand|wrist
Sent from the simulator to inform the rover server of a single frame of a camera stream.
{
type: "simCameraStreamReport",
camera: string,
data: string
}
camera
- the name of the camera:mast|hand|wrist
data
- the frame in JPG format encoded as a base-64 string
Sent from the simulator to inform the rover server of the rover's exact pose.
{
type: "simRoverTruePoseReport",
position: {
x: number,
y: number,
z: number
},
rotation: {
x: number,
y: number,
z: number,
w: number
}
}
position
- the position of the rover in standard Husky Robotics coordinatesrotation
- the rotation of the rover in standard Husky Robotics coordinates
Sent from the simulator to inform the rover server of the geographic position provided by a simulated GPS sensor. The position will be reported in standard geographic coordinates. The simulated GPS sensor will map Unity's cartesian origin to Null Island. Gaussian noise is applied to the latitude and longitude.
{
type: "simGpsPositionReport",
latitude: number,
longitude: number
}
latitude
- the latitude in degreeslongitude
- the longitude in degrees
Sent from the simulator to inform the rover server of the orientation provided by a simulated IMU. The orientation will be a quaternion in the standard Husky Robotics software coordinate system.
{
type: "simImuOrientationReport",
x: number,
y: number,
z: number,
w: number
}
x
- The x-component of the orientationy
- The y-component of the orientationz
- The z-component of the orientationw
- The w-component of the orientation