kandi X-RAY | Quadruped_Robot Summary
kandi X-RAY | Quadruped_Robot Summary
Quadruped_Robot
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Quadruped_Robot
Quadruped_Robot Key Features
Quadruped_Robot Examples and Code Snippets
Community Discussions
Trending Discussions on Quadruped_Robot
QUESTION
I have a class called Quadruped_Robot
that has four structures, fRight
, fLeft
, bRight
, and bLeft
that inherit from a base structure, Leg
. In Arduino, I am trying to actuate 8 servo motors by cycling through each one, and the four structures hold the servo driver channel value. I've created an array of pointers to the four structures, so that the function, actuateLeg
, can send PWM signals to the appropriate channel determined during runtime. However, none of the servos respond, and upon inspecting the values given by myLeg->channels[0]
and myLeg->channels[1]
, they report values that are in the range of thousands, both positive and negative. However, the values should be between 0
and 7
. Why are the channel values incorrect when I try to access them using the ->
operator?
ANSWER
Answered 2017-Mar-15 at 19:20You have redefined int channels[2]
in every successor, now you have Leg::channels available via Leg* and LegSuccessors::channels invisible in your use case. Leg::channels not initialiazed, so it filled with garbage values.
To solve the problem, first remove channels declarations in Leg successors. Second, redefine Leg* myLegs[4]
to {new fRight{0, 1}, new fLeft{2, 3}, ... and so on};
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Quadruped_Robot
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page