View on GitHub

JetsonEV

JetsonEV project page.

Download this project as a .zip file Download this project as a tar.gz file

Table of Contents

JetsonEV.JetsonEV

SPEED_PORT

Constant: TCP port being used to send speed measurement

CAMERA_PORT

Constant: TCP port being used to send camera frames

IMU_PORT

Constant: TCP port being used to send IMU measurements

LIDAR_PORT

Constant: TCP port being used to send lidar measurements

ARDUINO_CONFIG

Constant: Dictionary of pin configuration to use for arduino control. Default values are good to use for a MEGA. These values may be changed before constructing JetsonEV.


__init__

 | __init__(mode='xbox', initialize_imu=True, imu_bus=0, initialize_camera=False, initialize_lidar=False, max_speed_limit=5, max_duty_cycle=0.3, rc_control='VESC_CONTROL', rc_communication='/dev/ttyTHS1')

Arguments:

  • JetsonEV.xbox_mode
  • JetsonEV.xbox_direct_mode
  • JetsonEV.xbox_forwarding_mode

See here for more details on each mode.


start_speed_control

 | start_speed_control()

Starts the internal speed controller. Speed is controlled with set_motor_speed(). This may be called automatically depending on mode.


stop_speed_control

 | stop_speed_control()

Stops the internal speed controller.


shutdown

 | shutdown()

Shuts down the car. It is necessary to call this before this object goes out of scope in order to shut down the hardware properly.


start_sockets

 | start_sockets()

Starts all the TCP sockets in _output_sockets. This is called automatically in the constructor.


set_trigger_l_func

 | set_trigger_l_func(function)

Use this function when in xbox_forwarding_mode to assign a function to handle a signal from the left trigger.

Arguments:


set_trigger_r_func

 | set_trigger_r_func(function)

Use this function when in xbox_forwarding_mode to assign a function to handle a signal from the right trigger.

Arguments:


set_l_joystick_func

 | set_l_joystick_func(function)

Use this function when in xbox_forwarding_mode to assign a function to handle a signal from the left joystick.

Arguments:


set_r_joystick_func

 | set_r_joystick_func(function)

Use this function when in xbox_forwarding_mode to assign a function to handle a signal from the right joystick.

Arguments:


set_motor_speed

 | set_motor_speed(new_speed)

The value set here will be assigned to self.desired_speed. This is only effective in xbox_mode or if the internal speed controller is turned on with start_speed_control.

Arguments:


set_motor_percent

 | set_motor_percent(percentage)

This function will directly send a pwm signal to the motor controller. Do not use this while the internal speed control is running (i.e. DO NOT use while in xbox_mode or if start_speed_control() has been called).

Arguments:


set_steering_percent

 | set_steering_percent(percentage)

Arguments:


get_imu_values

 | get_imu_values()

:returns Latest measurement from the IMU.


get_lidar_values

 | get_lidar_values()

Returns:

Latest measurement from the Lidar sensor.


get_camera_frame

 | get_camera_frame()

Returns:

Latest camera frame.


get_speed

 | get_speed()

Returns:

Latest speed measurement (m/s)


add_timed_task

 | add_timed_task(calling_function, object_to_wrap=None, sampling_rate=10, calling_func_args=[], forwarding_function=None, verbose=False)

This is a helper function to create a TimedTask object. The only difference between using this and making a TimedTask directly, is that the resulting new task is also added to JetsonEV._timed_tasks which are all automatically stopped when shutdown() is called.

Arguments:

:returns The created TimedTask object.


start_all_tasks

 | start_all_tasks()

Starts all the created TimedTasks that are being tracked by JetsonEV. This is called in the constructor.


calibrate_imu

calibrate_imu(bus=0)

A function to zero out the gyros and orient the accelerometer to gravity. DOES NOT DO ANYTHING YET

Arguments: