Zoe control

General info :

To be able to communicate with the vehicle, you (your machine) must be in the same network than the Zoe vehicle (192.168.2.x). A swith and a wifi network are available in the vehicle, if you use static ip please take an ip address not already use.

List of use address :

IP User
192.168.2.20 main PC
192.168.2.10 lidar
192.168.2.25 Maxime PC
192.168.2.60 Gérald PC

To be able to communicate with the ROS Master of the main PC of the Zoe please add those line in you bashrc file :

export ROS\_MASTER\_URI=http://192.168.2.20:11311
export ROS_IP=192.168.2.x

X refer to your own ip address.

Using CAN ROS TOPIC :

In order to control the Zoe vehicle you have to publish on one of those ROS topics with a 100 Hz frequency :

- /cmd_accel

CmdAcceleration.msg :

Type Variable Name Value/Range
Header header
Float32 acceleration 0 to 6553.5
Bool can_publish True (enable control)

- /cmd_brake

CmdBrake.msg

Type Variable Name Value/Range
Header header
Float32 deceleration 0 to 6553.5
Bool can_publish True (enable control)

- /cmd_steering

CmdSteering.msg

Type Variable Name Value/Range
Header header
Float32 angle -720 to 720 deg
Float32 rotation_speed 0 to 6553.5 deg/s
Bool can_publish True (enable control)

Code Python example :

from can_zoe_msgs.msg import CmdSteering
from can_zoe_msgs.msg import CmdAcceleration
from can_zoe_msgs.msg import CmdBrake

acc = CmdAcceleration()
acc.can_publish = True # activation of accel
acc.acceleration = 0.0 # no accel

brk = CmdBrake()
brk.can_publish = True # activation of brake
brk.deceleration = 2000.0 # middle

steer = CmdSteering()
steer.can_publish = True # activation of steer
steer.cooperative_mode = 0
steer.rotation_speed = 100.0
steer.angle = 300

Using Twist ROS message :

To control the Zoe vehicle with a Twist ROS message you have to publish on this topic with a 100 Hz frequency :

  • / zoe/cmd_vel

Twist.msg

Type Variable Name Value/Range
Header header
Float32 linear.x 0 to 130 km/h (limit value can be changed)
Float32 linear.y n/o
Float32 linear.Z n/o
Float32 angular.x n/o
Float32 angular.y n/o
Float32 angular.z -500 to 500 deg (limit value can be changed)

Code Python example :

from geometry_msgs.msg import Twist

cmd = Twist()

cmd.linear.x = 20 # 20 km/h speed
cmd.angular.z = 190 # 190 deg steering

Using Joy ROS message :

Enable the control of the Zoe vehicle with a controller with this mappage :

Button Type Variable name Value/Range
A int32 [0] n/o
B int32 [1] n/o
X int32 [2] n/o
Y int32 [3] n/o
LB int32 [4] n/o
RB int32 [5] 0 (disable control) and 1 (Enable conrol)
Back int32 [6] n/o
Start int32 [7] n/o
power int32 [8] n/o
Button stick left int32 [9] n/o
Button sticj right int32 [10] n/o
Axis Type Variable name Value/Range
Left/Right Axis stick left float32 [0] n/o
Up/Down Axis stick left float32 [1] n/o
LT float32 [2] 1 (0) to 1 (5000) brake value
Left/Right Axis stick right float32 [3] 1 (-500 deg) to 1 (500 deg) steering
Up/Down Axis stick right float32 [4] n/o
RT float32 [5] -1 (0) to 1 (5000) accel value
cross key left/right float32 [6] n/o
cross key up/down float32 [7] n/o

ROS node to use a controller :

  rosrun joy joy_node

Code Python example :

from sensor_msgs.msg import Joy

joy = Joy()

joy.axes = [0,0,0,0,0,0,0,0]
joy.buttons = [0,0,0,0,0,0,0,0]

joy.buttons[5] = 1 # enable control

joy.axes[2] = -1 # no brake
joy.axes[5] = 0 # middle accel

joy.axes[3] = 0.3 # some steering to the right

PS : To make the control smother with a controller those mathematical formula are used :

Accel or Brake = (input -- Accel or Brake )

Steer = (input -- Steer )

Using python Zoe_tcp_control_client Class :

This class was made to simplify the control of the Zoe vehicle, and doesn't required a ROS environment.

Be carful : with this type of control no frequency control are required, so if your code bug the latest command sent will be play !

Zoe_tcp_control_clien Class :

Callable function :

  • start () : start the communication with the Zoe vehicle
  • ip_modify ( string ) : change ip of the tcp communication (by default , 192.168.2.20)
  • speed_modify ( float ) : change the speed target (km/h)
  • steer_modify ( float ) : change the angle value (deg) of the steering wheel

Use of the class :

from zoe_class import Zoe_tcp_control_client

zoe_control = Zoe_tcp_control_client


zoe_control.start() # start the communication with the vehicle

zoe_control.speed_modify(6.0) # change target speed to 6 km/h

zoe_control.steer_modify(-120) # set steering angle to -120 deg

Dernière édition le 2025-09-05 11:22

Propulsé par Wiki|Docs

This page was last edited on 2025-09-05 11:22

PRETIL
CRIStAL UMR9189

Propulsé par Wiki|Docs