Using arduino to control braking function of RC car

First, please forgive my explanation in English, I'm not a native speaker.

In the original remote, I can easily control my RC car forward by pushing back on the throttle button, braking by pushing forward the throttle button, and reverse by moving to the neutral point, then pushing forward the throttle button.

Now, I would like to use Logitech F710 to control my RC car instead of the original remote.
But I want to cancel the reverse function, like if I push forward the joystick, RC car can move forward, then if I pull down the joystick, RC car can brake, but if I push back joystick to the neutral point then pull down, the RC car can stand still.

I know I can configure the ESC to totally cancel the reverse function, but I actually want to keep the reverse function, I just want to use programming to adjust.

here is my code in Arduino IDE.
Screenshot from 2022-07-20 14-28-22

I use the ROS to publish my joystick signal on the Arduino IDE,
Ros_msg[3] > 3 means joystick push forward ,
Ros_msg[5] > 3 means joystick pull down,
model = 1 means I set RC car is in driving mode.

the ideal situation: If RC car move forward, variable temp will equal to 1, then pull down the joystick, Ros_msg[5] would > 3, then RC car can brake, but unfortunately when Ros_msg[5] > 3, the Ros_msg[3] would not > 3, because Ros_msg[3] and Ros_msg[5] are receiving the same joystick signal, means temp would not equal to 1 when Ros_msg[5] > 3.

How can fix my code to let my RC car move forward and brake, but cancel the reverse function.

Do You know how to download code at all? Is that unit made for reprogramming?

  1. You mean you need to see all Arduino code or something ?
  2. Yes, in order to use joystick to control RC car, so I'm reprogramming on the Arduino.

You show a snippet of code. What happens when You run it?

Let me explain how to control RC car move forward, backward, and brake.
First, Ros_msg[3] means pushing joystick forward, then Ros_msg[3] will be > 3, so you can move RC car forward.

Second, if you want to stop the RC car, it also means braking, you could just pull joystick backward, then Ros_msg[3] will be < 3 and Ros_msg[5] will be > 3.

Third, if you want to move RC car backward, you have to pull the joystick backward first, to stop the RC car, then release the joystick, let it back to the neutral point, and pull joystick backward to control RC car move backward.

Now, what I want is to reprogram to control RC car move forward and brake,
I don't want the moving backward function.

Let's see the code:
Ros_msg[3] > 3 means pushing the joystick forward, then temp = 1
when I want to brake the RC car, so I pull joystick backward, so Ros_msg[5] > 3, but Ros_msg[3] will be < 3, so I can't brake the RC car.

Because Ros_msg[3] and Ros_msg[5] are given the same joystick signal, so Ros_msg[3] > 3, Ros_msg[5] will < 3
Ros_msg[3] < 3, then Ros_msg[5] will > 3.

Please use graphical means to show the happengs, not a novel. Flowchart is one way.

This flow chart means what I want to implement on my Arduino IDE.

but unfortunately, Ros_msg[3] and Ros_msg[5] will take signals from the same joystick.
It means if Ros_msg[3]>3, then Ros_msg[5] will be < 3, and if Ros_msg[3]< 3, then Ros_msg[5] will be >3.

so back to my code, you will see I will be stuck in the Ros_msg[3] will >3 or not.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.