Quick Start
This is a quick start guide to get going with the voraus-robot-arm crate and move a robot.
It is assumed that a running voraus.core is available via the network.
Installation
Add the crate to your Cargo.toml:
[dependencies]
voraus-robot-arm = "<version>"
Moving a Robot
Import the prelude. It brings all traits, types, and robot structs into scope:
use voraus_robot_arm::prelude::*;
Next, instantiate the desired robot, connect it to the voraus.core by host and port, and enable it. Before the robot
can move, it must be enabled. The example reads host and port from the environment variables VORAUS_CORE_HOST and
VORAUS_CORE_PORT; an application passes its own values:
let mut robot = VorausIndustrialRobotArm::new();
robot.connect(&common::robot_host(), common::robot_port())?;
robot.enable()?;
Now a point-to-point motion can be performed. start() queues the motion on the robot and join() blocks until it
has finished:
robot.move_ptp(poses::home()).start()?.join()?;
When the robot goes out of scope, it is disabled and disconnected automatically. Call disable() and disconnect()
explicitly if you need to observe their result.
In order to see what a robot is capable of, rely on your editor: the traits a robot implements are exactly the
capabilities it offers, and rust-analyzer lists them on robot..
If you want to learn more about the concepts and possibilities of this library, please see the key concepts chapter.
Full Example
The complete program moves the robot to two poses on the voraus.core named by VORAUS_CORE_HOST.
Quick start example
//! Quick start: connect, enable, move to two poses, then disconnect.
mod common;
use common::poses;
use tracing::info;
use voraus_robot_arm::prelude::*;
fn main() -> voraus_robot_arm::error::Result<()> {
common::init_logging();
// Create the robot, connect it to the voraus.core and enable it. The
// host and port come from `VORAUS_CORE_HOST` and `VORAUS_CORE_PORT`.
let mut robot = VorausIndustrialRobotArm::new();
robot.connect(&common::robot_host(), common::robot_port())?;
robot.enable()?;
// `start()` queues the motion; `join()` blocks until it finishes.
info!("Moving to HOME...");
robot.move_ptp(poses::home()).start()?.join()?;
info!("HOME reached.");
info!("Moving to VERTICAL...");
robot.move_ptp(poses::vertical()).start()?.join()?;
info!("VERTICAL reached.");
// Dropping the robot disables it and disconnects.
info!("Done.");
Ok(())
}