Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

%Create msg
trajectory = VehicleCommandTrajectory;
% Set the vehicle ID
trajectory.vehicle_id = uint8(vehicle_id);
trajectory_points = [];
point1 = TrajectoryPoint;

% This trajectory point should be considered in the future, so add some nanoseconds to the current time
time = t_eval + 400000000;
stamp = TimeStamp;
stamp.nanoseconds = uint64(time);
point1.t = stamp;

% Set other trajectory values
point1.px = trajectory_point(1);
point1.py = trajectory_point(2);
point1.vx = trajectory_point(3);
point1.vy = trajectory_point(4);

trajectory_points = [trajectory_points [point1]];
trajectory.trajectory_points = trajectory_points;

% Send trajectory to vehicle
trajectoryWriter.write(trajectory);

Parameter Usage Example

./middleware --vehicle_ids=1,7,8 --node_id=middleware --wait_for_start=true --dds_domain=1 --simulated_time=false

Bash script

If you want to start your script using a bash script, you can do it like this:

/opt/MATLAB/R2019a/bin/matlab -logfile matlab.log -sd $script_dir -batch "$script_name(1, ${vehicle_id})"

Usually, you would want to start it using the LCC instead, which takes care of these things for you.