Control Mapping problems in WindRiver

Okay we have tried several things, and are trying to mutate these functions, but are unable to and we are unsure of how.

We are trying to get it to several things:

  1. when we use Joystick to do the function GetX() it says GetX() hasn’t been defined, and we tried Joystick.GetX() and it says you need a parent class or something b4 Joystick, so how do I declare GetX??
  2. We are trying to use the log function also in this, but we can’t find a way to convert float to a non double number or a double number for use by myRobot.. ect…
  3. How do you do a state machine with a button?

This is confusing, and I have looked through the header files to try and understand what is going on, but the files just call a bunch more header files and it just looks all stubbed out, and it seems really hard to mutate, so any help would be very nice! :confused:

You need to create an instance of the Joystick class. This should be done as a member variable in your robot class, outside of any of the functions in it.

Joystick stick(1); // USB joystick in port 1.

After you have your Joystick object created, you can use it like this:

float value = stick.GetX(); // Get the X value of the joystick.

You can read more about C++ classes here.

I’m not quite sure what you’re asking about, but the log() function should work just fine with floats. You just need to #include <math.h>.

Again, I’m not entirely sure what you want to do, but if you’re talking about using a button to toggle something on/off that has been discussed here: